Skip to content

Instantly share code, notes, and snippets.

@jlittlejohn
Created December 13, 2012 21:15
Show Gist options
  • Save jlittlejohn/4279973 to your computer and use it in GitHub Desktop.
Save jlittlejohn/4279973 to your computer and use it in GitHub Desktop.
JS: Ajax Template
$.ajax({
type: 'POST',
url: 'backend.php',
data: "q="+myform.serialize(),
success: function(data){
// on success use return data here
},
error: function(xhr, type, exception) {
// if ajax fails display error alert
alert("ajax error response type "+type);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment