Skip to content

Instantly share code, notes, and snippets.

@skyebook
Created August 1, 2012 23:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skyebook/3231657 to your computer and use it in GitHub Desktop.
Save skyebook/3231657 to your computer and use it in GitHub Desktop.
Post Body to Javascript Fail
function doRequest(request, headers, http_method, request_body, successCallback, failureCallback){
$.ajax({
url: api+request,
headers: headers,
data:JSON.stringify(request_body),
//data:request_body,
processData:false,
type: http_method,
contentType: "application/json",
error: function(XMLHttpRequest, textStatus, errorThrown){
failureCallback(textStatus, errorThrown);
},
success: function(data){
successCallback(data);
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment