How to submit a form with ajax in jQuery

To submit a form with ajax in jQuery you can use the following snippet.

Sample jQuery

jQuery.fn.submitWithAjax = function() {
	this.submit(function() {
		$.post(this.action, $(this).serialize(), null, "script");
		return false;
	});
	return this;
};

2 thoughts on “How to submit a form with ajax in jQuery

Leave a Reply