The general form submission operation is written as
Click the submit button or press Enter directly to submit the data to the saveReport page, but it will also jump to the saveReport page after submission
How to do it
Submit the data to saveReport (action of the form Points to) page, but the page does not jump, that is, the current page remains unchanged? ?
This need is especially urgent when loading a page.
Use jquery's ajaxSubmit function and form's onsubmit function to complete, as follows:
Form adds an id for calling in jquery, and adds an onsubmit function for submitting before submitting. The corresponding function of form
saveReport is
function saveReport() {
// jquery form submission
$("#showDataForm").ajaxSubmit(function(message) {
// For processing after successful form submission, message is the submission page saveReport.htm Return content
});
return false; // False must be returned, otherwise the form will submit again and the page will jump
}