我想送使用$阿贾克斯的数据是这样的:
$.ajax({'url': 'my.php',
'type': 'POST',
'data': arr,
'success': function(response) {
alert(response);
}
});
的问题是,arr
是一个关联数组,看起来像:
arr['description_0'] = 'very nice picture!';
arr['tags_0'] = 'David "Nice Picture" 2010';
arr['description_1'] = 'In the pool';
arr['tags_1'] = '"April 2010" Australia';
. .
. .
. .
如果my.php
样子:
<?php
echo count($_POST);
?>
response
是0.
但是,如果我改变
'data': arr,
到
'data': 'a=chess&b=checkers',
的response
是2,符合市场预期。
我应该如何将arr
转换为数据才能正确发送?
这工作就好了原样。你有特定的问题吗? – hobbs 2010-08-03 02:04:31
是的,我更新了问题。 – 2010-08-03 02:20:31
by arr being'associative array',我假设你的意思是一个JavaScript对象? – JAL 2010-08-03 02:38:43