开发者

javascript array passed to post into PHP array

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜