Skip to content

Instantly share code, notes, and snippets.

@dotku
Last active August 23, 2016 23:52
Show Gist options
  • Select an option

  • Save dotku/fe5fa671376dcdf6d6559753150fd1d7 to your computer and use it in GitHub Desktop.

Select an option

Save dotku/fe5fa671376dcdf6d6559753150fd1d7 to your computer and use it in GitHub Desktop.
http://stackoverflow.com/questions/6323338/jquery-ajax-posting-json-to-webservice
http://stackoverflow.com/questions/21201270/how-to-submit-json-data-by-request-body-in-jquery
$.ajax({
url : "/",
type: "POST",
data: JSON.stringify([
{id: 1, name: "Shahed"},
{id: 2, name: "Hossain"}
]),
contentType: "application/json; charset=utf-8",
dataType : "json",
success : function(){
console.log("Pure jQuery Pure JS object");
}
});
// sample api: https://api.ipify.org?format=json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment