This article is mainly to the AJAX submission and form submission of the difference between the detailed introduction, the need for friends can come to the reference, I hope to help you.
Now compare the pros and cons of Ajax with hidden form submissions. 1. Hide form submission, update data after the completion of the need to go to a blank page and then the original page to submit after processing; Ajax is not, you can directly return to the original page for processing after submission. Visible Ajax can add a page less than the hidden form submission. 2.ajax For security reasons, you cannot operate on files, so you cannot upload files through Ajax, and by hiding form submissions You can do this, so this is the main purpose currently submitted with a hidden form. Now next describes how to implement file uploads by hiding the form 1) First define a form for filling out forms <form name= "Form1" ></form> 2) Then define a form for submission <form name= "Form2" target= "Myiframe" > //to specify that the returned page of the submission is displayed in this hidden iframe < The iframe name= "Myiframe" style= "Display:none" ></iframe> //is used to store the blank page <div id= "Forminner" after the return of the submission Style= "Display:none" ></div> //used to get Form1 HTML content, get Form1 table cell element </form> 3) at Form1 submission, Do the following JavaScript processing var forminner= document.getelementbyid ("Forminner"); forminner.innerhtml = form1.innerhtml; //copy Form1 html code form2.action = form1.action; Form2.submit (); 4 After the submission, into the background processing, after the completion of the background processing, you need to return a blank page blank.jsp, this page is generated in the hidden iframe, so you can use the parent object to the original page to operate. such as the original page defines a updatepagefromsubmit (), then theblank.jsp pages can be parent.updatepagefromsubmit () to invoke processing after a commit return