开发者

jQuery Ajax posting Arrays instead of simple data

开发者 https://www.devze.com 2022-12-27 15:38 出处:网络
Hey, I\'ve tried to update jQuery to its latest version on a system I\'m working and I\'m having this issue:

Hey, I've tried to update jQuery to its latest version on a system I'm working and I'm having this issue:

I have a file that posts data to a .php:

$.post(

'ajax_Save.php',
{
id: [$('#service_id').val()],
number: [$('#number').val()]
},
    function(data){
...
});

On ajax_Save.php var_dump($_POST) gives:

array(26) { ["id"]=>  array(1) { [0]=>  string(5) "18204" } ["number"]=>  array(1) { [0]=>  string(5) "18250" }...

With jQuery开发者_Go百科 version 1.2.2 the result is:

array(26) { ["id"]=>  string(5) "18204" ["order_number"]=>  string(5) "18250"

Which is OK.

Any clues? Thx


Replace with:

$.post(

'ajax_Save.php',
{
id: $('#service_id').val(),
number: $('#number').val()
},
    function(data){
...
});
0

精彩评论

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

关注公众号