class Ajax.Response
Description
A wrapper class around XmlHttpRequest for dealing with HTTP responses
of Ajax requests.
An instance of Ajax.Response is passed as the first argument of all Ajax
requests' callbacks. You will not need to create instances of
Ajax.Response yourself.
Class methods
-
getAllResponseHeaders #
Ajax.Response.getAllResponseHeaders() ⇒ StringReturns a string containing all headers separated by line breaks; throws an error if no headers exist. This is just a wrapper around the
XmlHttpRequestmethod of the same name. -
getResponseHeader #
Ajax.Response.getResponseHeader(name) ⇒ StringReturns the value of the requested header if present; throws an error otherwise. This is just a wrapper around the
XmlHttpRequestmethod of the same name.
Instance methods
Instance properties
-
headerJSON #
Ajax.Response#headerJSON -> Object | Array | nullAuto-evaluated content of the
X-JSONheader if present;nullotherwise. -
readyState #
Ajax.Response#readyState -> NumberThe request's current state.
0corresponds to"Uninitialized",1to"Loading",2to"Loaded",3to"Interactive", and4to"Complete". -
request #
Ajax.Response#request -> Ajax.Request | Ajax.UpdaterThe request object itself (an instance of
Ajax.RequestorAjax.Updater). -
responseJSON #
Ajax.Response#responseJSON -> Object | Array | nullThe JSON body of the response if the
Content-typeof the request is set toapplication/json;nullotherwise. -
responseText #
Ajax.Response#responseText -> StringThe text body of the response.
-
responseXML #
Ajax.Response#responseXML -> document | nullThe XML body of the response if the
Content-typeof the request is set toapplication/xml;nullotherwise. -
status #
Ajax.Response#status -> NumberThe HTTP status code sent by the server.
-
statusText #
Ajax.Response#statusText -> StringThe HTTP status text sent by the server.
-
transport #
Ajax.Response#transport -> XmlHttpRequestThe native
XmlHttpRequestobject itself.