Skip to content

Instantly share code, notes, and snippets.

@biomood
Created August 1, 2011 13:33
Show Gist options
  • Save biomood/1118122 to your computer and use it in GitHub Desktop.
Save biomood/1118122 to your computer and use it in GitHub Desktop.
Ajax sending a POST request with json
$.ajax({
url: "Service/request",
async: false,
type: "POST",
dataType: "json",
contentType: "application/json",
data: JSON.stringify(obj),
cache: false,
success: function (data) {
alert(data);
},
error: function (jqXHR, textStatus, errorThrown) {
alert(textStatus);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment