Skip to content

Instantly share code, notes, and snippets.

@sihugh
Created May 29, 2015 11:03
Show Gist options
  • Save sihugh/e7d9440c87fa02c0d8df to your computer and use it in GitHub Desktop.
Save sihugh/e7d9440c87fa02c0d8df to your computer and use it in GitHub Desktop.
Stringify Before POSTing
var data = {
name: "dave",
age: 35,
height: 188};
var submitData = JSON.stringify(data);
$.ajax({
headers: { "X-RequestDigest": formDigestValue },
url: url,
method: "POST",
contentType: "application/json",
data: submitData,
success: success,
error: error
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment