How do you process a javascript array in PHP, when you're posting it. Here's what I am doing:
$(".action_btn").live('click', function() {
var friends = new Array();
$(this).parents('.friends_rec').find('input:checked').each(function(k) { friends[k] = $(this).val(); });
var comment = $(this).parents('.friends_rec').find('textarea').val();
$.post("upd开发者_如何学JAVAate.php",
{ uid: <?php echo $_SESSION['uid']; ?>, mid: <?php echo $_GET['mid']; ?>, friends: friends, comment: comment },
function() {
});
}
});
Question is, in update.php, what should I do to iterate this friends array?
try to use
$.post("update.php",
{ uid: <?php echo $_SESSION['uid']; ?>, mid: <?php echo $_GET['mid']; ?>, 'friends[]': friends, comment: comment },
function() {
});
or you can use friends.join("#"), for example and in php-script explode() func
精彩评论