Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

javascript
html

What is Ajax Response?

Sarvech Qadir

AjaxAsynchronous JavaScript And XML is used to create asynchronous web applications. It is deployed on the client-side and makes use of several web technologies.

Ajax has made it easier to send and retrieve data from a server asynchronously without interfering with the existing page’s display and functionality.

Ajax not a programming language and it requires a built-in browser with the XMLHttpRequest object, which requests data from the server. It also uses JavaScript and HTML DOM to display the data.

Ajax response is the server response, and Ajax.Response is the object passed as the first argument of all Ajax requests callbacks.

Properties

status Type: Number. The server sends the HTTP status code.

statusText Type: String. Status text sent by sever.

readyState Type: Number. The current state of the request. The numbers are on the left side and state on the right side.

0 => Uninitialized

1 => Loading

2 => Loaded

3 => Interactive

4 => Complete

responseText Type: String. Response sent refers to the text body.

responseXML Type: document Object. Response of body that comprises of XML. This only works if the request is set to XML.

responseJSON Type: Object, Array. Response of body that comprises of JSON. This only works if the request is set to JSON.

headerJSON Type: Object, Array. X-JSON (if present) sends auto-evaluated content. It is used to transfer little pieces of data.

request Type: Object. The request object.

transport Type: Object. Refers to the xmlHttpRequest object itself.

Methods

getHeader(name) Type: String. This method returns the value of present header (if requested); otherwise, null.

getAllHeaders() Type: String. This method returns a string. This contains all headers as a string.

getResponseHeader(name) Type: String. This method returns the value of the present header (if requested and if present); otherwise, it throws an error.

getAllResponseHeaders() Type: String. This method returns a string and contains all headers as a string; otherwise, it throws an error otherwise.

RELATED TAGS

javascript
html

CONTRIBUTOR

Sarvech Qadir
Copyright ©2022 Educative, Inc. All rights reserved
RELATED COURSES

View all Courses

Keep Exploring