XMLHttpRequest : EventTarget
'GET'
as the method when calling open()
) or to send data to the server by making a POST request (send 'POST'
as the method when calling open()
). See also fetch.Instance Properties
Returns the response from the server in the type specified by responseType
. Only valid after the load
event fires.
Example:
RunResults:
Returns the response from the server as a string. Only valid after the load
event fires and if responseType
is set to ''
(the default) or 'text'
.
Example:
RunResults:
Determines the type returned by response
. Must be set to one of the following:
responseType | response returns |
---|---|
'' (default) | Same as 'text' |
'text' | String |
'arraybuffer' | ArrayBuffer |
'blob' | Blob |
'document' | Document |
'json' | Object |
Must be set before
readyState
reaches LOADING
.Example:
RunResults:
The http status code for the request. See statusText
for a description of the code.
Example:
RunResults:
Returns an XMLHttpRequestUpload
object associated with this XMLHttpRequest that can be used to track the upload status of the send()
call.
Instance Methods
Returns a string containing all header value pairs from the response.
Example:
RunResults:
Returns the value for the specified header
. Returns null
if the headers do not contain a value for header
.
Example:
RunResults:
Specifies the url
to read from and the http method ('GET'
, 'POST'
, 'PUT'
, 'DELETE'
, etc) to use when reading the url. If async
is true
, the request will be asynchronous and you should provide an onload
callback to be called when the read completes. In general, it is best to use the asynchronous request so the browser remains responsive while the request is in progress. Call send()
to begin the request.