The client uses XMLHTTP to send requests to get the server response data, and use the JavaScript operation DOM final update page - also known as the refreshed update page, instead of the traditional web development using Form (form) to update the web page. Trend.
XMLHTTP relies on XMLHttpRequest to complete the response from the client's request to the server. XMLHttpRequest provides two methods Open and Send. Open method is used to initialize the XMLHttpRequest object, indicating the way the request (GET, POST, etc.), security connections, etc., you must call the Send method to send HTTP Request (HTTP Request) after calling the Open method. See the MSDN Introduction to send methods:. This method is synchronous or asynchronous, depending on the value of the bAsync parameter in the open call If open is called with bAsync == False, this call does not return until the entire response is received Or the protocol stack time. if open is called with basenc == true, this call return method Synchronization or asynchronous work depends on the BASYNC parameter in the open method, if Basync == false means the SEND method is working in the synchronization state Next, after sending an HTTP request, only the client receives all the answers data from the server or the protocol stack timeout return! Basync == True, working directly in an asynchronous state, returning directly.
In the actual use, set BASYNC = True, so that the XMLHttpRequest works in an asynchronous state after the send method is called, and if set to synchronous status, it may cause unnecessary long waiting!
In addition, regardless of the response data returned by the server whether XMLHTTPREQUEST is returned by the server regardless of the synchronous or asynchronous request operating state? Look at the sample code below: