Return to Snippet

Revision: 72411
at August 19, 2017 21:47 by catswhocode


Initial Code
jQuery( document ).ready(function() {
	jQuery( "#submit" ).click(function() {
		 jQuery.post( "https://yoursite.com/yourpage.php", jQuery('#form').serialize())
			.done(function( data ) {
			alert(data);
		}); 
		return false;
	});
});

Initial URL
https://www.catswhocode.com/blog/jquery-and-ajax-ready-to-use-code-snippets-for-every-day

Initial Description
Here’s a super handy snippet that I use very often. It works very simply: once the user clicks on #submit, the data from #form is serialized and sent to a remote page using the POST method.

Initial Title
Get all values from form and send it to a page via Ajax

Initial Tags
form, ajax

Initial Language
jQuery