Example:
$.post("test.php", { name: "John", time: "2pm" } );
$.post("test.php", { 'choices[]': ["Jon", "Susan"] });
$.getJSON("test.js", { name: "John", time: "2pm" }, function(json) {
alert("JSON Data: " + json.users[3].name);
});
JSON.Stringify(), instead the data is serialised into a html query string.That way you can do (see here):
$.ajax({
url: "/path/to/url",
type: "POST",
dataType: "json",
contentType: "application/json",
data: JSON.stringify({"foo": "bar"}),
success: function(){
alert("success :-)");
},
error: function(){
alert("fail :-(");
}
});