Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Object JavaScript - jQuery post sample
var post = $.ajax({
url: "/echo/json/",
data: {
json: JSON.stringify({firstName: "Jose", lastName: "Romaniello"})
} ,
type: "POST"
});
post.done(function(p){
alert(p.firstName + " saved.");
});
post.fail(function(){
alert("error!");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment