var labels = new Array();
<?php foreach($crud_data as $cd ) { ?>
labels['<?php echo $cd['name'] ; ?>'] = '<?php echo $cd['label'] ; ?>';
<?php } ?>
$.post('url.php' , { labels:labels} );
labels
このように配列を送信できないのはなぜですか? Firebug には何も表示されません。
私のconsole.log(labels)
結果:
[]
avatar
"avatar"
email
"email"
id
"id"
name
"name"
password
"password"
このように配列にデータを入力すると
<?php foreach($crud_data as $cd ) { ?>
labels.push('<?php echo $cd['label'] ; ?>');
<?php } ?>
$.post('url.php' , { labels:labels} );
それは正常に動作します!