var data={}, arry=[];
for ( o in data){ arry.push(o,data[o]); }
var postdata = {'arry[]':arry, 'mail' :email};
$.post('up.php', postdata)
以上可以,但是以下就不行:
var data={}, arry=[];
for ( o in data){ arry[o]=data[o]); } // 带有字符串键的数组 怎样 post
var postdata = {'arry[]':arry, 'mail' :email};
$.post('up.php', postdata)
请问咋回事呢?
------解决方案--------------------
数组的key只能是数字,
用下面那样吧
var postdata = {'arry[]':JSON.stringify(data), 'mail' :email};
$.post('up.php', postdata)
IE不支持JSON.stringify,LZ可以引入json2.js