Standard Form Submit vs Ajax Form Submit - Browser Auto Save/Suggest User Input Standard Form Submit vs Ajax Form Submit - Browser Auto Save/Suggest User Input ajax ajax

Standard Form Submit vs Ajax Form Submit - Browser Auto Save/Suggest User Input


When any button of type submit is clicked, the enclosing form is submitted. You can choose to handle the submit event instead of the button's click event. Here is an example:

$('#demoForm').submit(function(evt) {    evt.preventDefault();    var data = $(this).serialize();    alert(data);});​

There's a Fiddle for you, too.

By catching the later event, you'll ensure that at least some browsers have a chance to store the form data for future auto-fills.