Skip to content

Instantly share code, notes, and snippets.

@HarishAtGitHub
Created November 28, 2015 18:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HarishAtGitHub/6737be9c2c1ea04a1892 to your computer and use it in GitHub Desktop.
Save HarishAtGitHub/6737be9c2c1ea04a1892 to your computer and use it in GitHub Desktop.
$(document).ready(
function() {
$("form#form").submit(function(e) {
e.preventDefault();
var actionurl = e.currentTarget.action;
console.log(actionurl);
console.log( $("form#form").serialize());
$.ajax({
url: actionurl,
type: 'post',
data: $("form#form").serialize(),
success: function(data) {
console.log(data);
console.log("success");
},
error: function( jq, status, error) {
console.log(status);
console.log(error);
},
complete: function(jqxhr, status) {
console.log(status);
}
});
});
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment