jQuery.Ajax makes the wrong request with array data
Posted
by user46503
on Stack Overflow
See other posts from Stack Overflow
or by user46503
Published on 2010-04-23T01:41:36Z
Indexed on
2010/04/23
1:43 UTC
Read the original article
Hit count: 308
Hello, I have the following array:
var idParam = ["1","2","3"];
I want to send this data as request using jQuery.ajax, what I'm doing:
$.ajax({
type: "GET",
url: "Services/GetInfo.ashx",
data: { "id": idParam },
contentType: "application/text",
dataType: "json",
success: function(result)
{
...
},
error: function(XMLHttpRequest, textStatus, errorThrown)
{
...
}
});
But as result I have the following ugly string: ?id[]=1&id[]=2&id[]=4 (actually it's much uglier:id%5B%5D=1&id%5B%5D=2&id%5B%5D=4).
What to do to get the normal string like: id=1&id=2&id=4 ?? Thanks
© Stack Overflow or respective owner