jQuery.Ajax makes the wrong request with array data
- by user46503
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