Skip to content

Instantly share code, notes, and snippets.

@smokinjoe
Last active December 24, 2015 08:59
Show Gist options
  • Save smokinjoe/6773887 to your computer and use it in GitHub Desktop.
Save smokinjoe/6773887 to your computer and use it in GitHub Desktop.
AJAX Template
$.ajax({
type: "POST",
url: "/route/to/dealie",
dataType: 'json',
data: {
var1 : var1,
var2 : var2
},
// given a json object with result property
success: function(response) {
if(response.result === true) {
alert('Success');
successf();
} else if(response.result === false) {
alert('error: ' + response.result);
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment