Constructor
new L3D.WebRequest(url, method, options)
new WebRequest(url, "GET", {
responseType: "arraybuffer",
onLoad: function(data) {
_parseImage(data, texture);
},
onError: function(status) {
console.error("Error requesting", url, ":", status);
}
});
url |
String | The URL to send the request to. |
|||||||||||||||||||||||||||||||||
method |
String | The type of request to send. For example, "CREATE", "DELETE", "GET", "POST", or "PUT". |
|||||||||||||||||||||||||||||||||
options |
Object | Options for the request. Properties
|
Properties
Have the request headers been recieved.
Has the request finished?
Was there an error with the request?
Is the request still on-going?
How many bytes have been recieved so far.
The percentage of the total bytes recieved so far.
The method of the request.
The xhr ready state.
The xhr response.
The xhr response text.
The xhr response type.
The xhr status.
The xhr status text.
How long to wait before considering the request timed out.
How many bytes are expected to be recieved.
The URL of the request.
The underlying XMLHttpRequest object.
Methods
static Get(url, options) → WebRequest
Send a GET request to the url.
Shorthand for new WebRequest(url, WebRequest.GET, options).send().
url |
String | The URL to send the request to. |
options |
Object | See the constructor for the list of options. |
static Head(url, options) → WebRequest
Send a HEAD request to the url.
Shorthand for new WebRequest(url, WebRequest.HEAD, options).send().
url |
String | The URL to send the request to. |
options |
Object | See the constructor for the list of options. |
static Post(url, options, data) → WebRequest
Send a POST request to the url.
Shorthand for new WebRequest(url, WebRequest.POST, options).send(data).
url |
String | The URL to send the request to. |
options |
Object | See the constructor for the list of options. |
data |
* | The data to post |
static Put(url, options, data) → WebRequest
Send a PUT request to the url.
Shorthand for new WebRequest(url, WebRequest.PUT, options).send(data).
url |
String | The URL to send the request to. |
options |
Object | See the constructor for the list of options. |
data |
* |
abort()
Abort the request.
getAllResponseHeaders() → String
Get all of the xhr response headers.
- String
getResponseHeader(name) → nullable String
Get the xhr response header with the given name.
name |
Sting |
- String
overrideMimeType(mime)
Acts as if the Content-Type header value for response is mime.
(It does not actually change the header though.)
mime |
String | The mime type. |
send(body) → WebRequst
Send the request.
body |
* | The optional data to send. |
- WebRequst
Returns self.
setRequestHeader(header, value)
Set a request header value.
header |
String | |
value |
String |