$.get ("/asd", {
asd: "foo"
}, function (res){
alert ("ok");
});
This sends the parameters in the querystring:
/asd?asd=foo
But I just need to use the http body to send the json object:
{ "asd": "foo" }
$.get ("/asd", {
asd: "foo"
}, function (res){
alert ("ok");
});
This sends the parameters in the querystring:
/asd?asd=foo
But I just need to use the http body to send the json object:
{ "asd": "foo" }
If you want to send a JSON object then you should really be using POST. However, if you absolutely need to use GET, you can do:
$.get ("/asd", { json: JSON.stringify({asd: "foo"}) }, function (res){
alert ("ok");
});
This will convert the JSON object into a string and pass it into the json
GET parameter (be cautious, JSON.stringify
does not work on older browsers).