Skip to content

Instantly share code, notes, and snippets.

@Injac
Created February 14, 2014 15:11
Show Gist options
  • Save Injac/9002700 to your computer and use it in GitHub Desktop.
Save Injac/9002700 to your computer and use it in GitHub Desktop.
Ajax request from jQuery to Web Api - this is how to do it.
$.ajax({
url: 'YOUR WEB API URL',
type: 'POST/PUT/WHATEVER',
dataType: 'json',
contentType: 'application/json; charset=utf-8', //IMPORTANT!
data: JSON.stringify(appId),
success: function () { alert('COMPLETED!'); },
error: function (xhr, message, error) {
alert(error);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment