Submit form using ajax jQuery plug-in
This plug-in will prevent your form's default action on submission and instead submit all data using XHR. Use it like this:
// submit the '#contact form'-form using XHR, then update the #contact-element with the response
It will submit to the form's action using the form's method unless specified differently when calling the plug-in.
The plug-in will submit any element in the form that has a name-attribute to the URL specified in action.
The ajaxSubmit plug-in takes two arguments, the first is either a string containing a CSS-selector pointing to the element that should be updated with the response, or a custom callback-function that will run after ajax-response is ready. The response will be passed to the callback function.
The second argument is a config-object where you can set action, method and loading. They default to form's action, form's method and 'Loading...'. The loading-var is used to replace the text in the submit-button. You may wanna change to 'Sending...' or something similar if that is more appropriate.
You can get the latest version of the jQuery ajaxSubmit plug-in here.