/ Published in: jQuery

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.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
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; }); });
URL: https://www.catswhocode.com/blog/jquery-and-ajax-ready-to-use-code-snippets-for-every-day
Comments
