Synchronous submission behavior of form

concept

  • The form has a default submission behavior, which is synchronous by default . When the synchronous form is submitted, the browser will lock up (turn around) and wait for the response from the server.

  • Synchronous submission means that the browser must wait for the server to respond before performing subsequent operations. Asynchronous submission can perform subsequent operations without waiting for the server to respond.

  • The action and method attributes inside the form tag are used to write synchronous submission behavior

  • Synchronous form submission, the browser will directly render the content of the server response to the page , that is to say, after the synchronous submission of the form, no matter what the server response is, it will directly overwrite the current page with the result of the response.

  • For example, after the form is submitted synchronously, the server returns a JSON data, then the JSON data will be displayed on the page
    Insert picture description here

  • Note : For synchronous requests, the server redirect code is only valid . For asynchronous requests, redirection on the server side is invalid, and the redirection must be performed on the client side.


Reference article

https://www.cnblogs.com/liuqifeng/p/13214946.html

Guess you like

Origin blog.csdn.net/weixin_43974265/article/details/112444596