Validating a submit request with javascipt
There are two ways to use an image instead of the button. You can use image input type to create a submit button.
When there are many fields in the form, the Java Script validation becomes too complex.
And this should not be asynchronous, nor use XML, so Ajax is not the answer.
@mricci The point of this snippet is to redirect the browser to a new URL specified by the action; if you're staying on the same page you can just use traditional AJAX to POST your data.
Generally, a form is submitted when the user presses a submit button.
However, sometimes, you may need to submit the form programmatically using Java Script.
Since the post requires the "body" of the request to be a query-string formatted string, this allows your Ajax request to work properly as a post.