Skip to content

Instantly share code, notes, and snippets.

@r37r0m0d3l
Forked from pithyless/gist:1547408
Created October 2, 2013 19:16
Show Gist options
  • Save r37r0m0d3l/6799038 to your computer and use it in GitHub Desktop.
Save r37r0m0d3l/6799038 to your computer and use it in GitHub Desktop.
// jQuery Headers support for $.ajax
$.ajax({
beforeSend: function(xhrObj){
xhrObj.setRequestHeader("Content-Type","application/json");
xhrObj.setRequestHeader("Accept","application/json");
}
type: "POST",
url: "/article",
processData: false,
data: jsonData,
dataType: "json",
success: function(json){
do something...
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment