+ -
当前位置:首页 → 问答吧 → $.post 提交的变量,为什么变成了数组

$.post 提交的变量,为什么变成了数组

时间:2010-05-21

来源:互联网

看下面的一段:
var aid='12';
$.post('/acc.php', {id: aid, action: 'dropa'},
              function(data){
                  if ('undefined' == data.error){
                      $.each(data, function(i, item){
                          $(this).parents('tr').remove();
                      });
                  }else alert(urldecode(data.error));
              }, 'json');

html跟踪工具显示, post的变量 id, 变成了 id[] :12
而且 acc.php 确实无法得到 $_POST['id']
php获得数据:
$_POST=Array
(
    [id] => Array
        (
            [0] => 21
        )
    [action] => dropa
)
jquery 1.3.2, 有谁遇到过吗?

作者: sisic   发布时间: 2010-05-21