Skip to content

Instantly share code, notes, and snippets.

@RimonEkjon
Forked from SamWM/AjaxForm.js
Created August 26, 2014 04:10
Show Gist options
  • Save RimonEkjon/35cddf7b9e8315152d59 to your computer and use it in GitHub Desktop.
Save RimonEkjon/35cddf7b9e8315152d59 to your computer and use it in GitHub Desktop.
function AjaxForm() {
$("form.ajaxform").submit(
function(e) {
e.preventDefault();
var dataString = $(this).serialize();
var method = this.method.toUpperCase();
var action = this.action;
$.ajax({
type: method,
url: action,
data: dataString,
success: function(response) {
alert(response);
}
});
}
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment