Post below
XMLHttpRequest. Send ()
Send an HTTP request
Syntax
Send (Body)
If you call
The HTTP method specified by open () is post or put. The body parameter specifies the Request body as a string or document object.
If the request body is not required, this parameter is null.
This parameter is unavailable for any other method and should be null (some implementations cannot omit this parameter ).
Description
This method causes an HTTP request to be sent. If open () is not called before, or, more specifically, if readystate is not 1, send () throws an exception. Otherwise, it sends an HTTP request consisting of the following parts:
* The HTTP method, URL, and authentication qualifications (if any) specified when you call open ).
* The Request Header specified when setRequestHeader () was called (if any ).
* The Body parameter passed to this method.
Once the request is published, send () sets readystate to 2 and triggers the onreadystatechange event handle.
If the previously called open () parameter async is false, this method will be blocked and will not be returned until the readystate is 4 and the server's response is fully received.
Otherwise, if the async parameter is true or this parameter is omitted, send () returns immediately, and as described later, the server response will be processed in a background thread.
If the server response carries an HTTP redirection, The send () method or background thread automatically follows the redirection. When all HTTP Response Headers have been received, the send () or background thread sets readystate to 3 and triggers the onreadystatechange event handle.
If the response is long, the send () or background thread may trigger the onreadystatechange event handle in status 3: this can be used as a download progress indicator. Finally, when the response is complete, the send () or background thread sets readystate to 4 and triggers the event handle for the last time.