XMLHttpRequest

From Wiki @ Karl Jones dot com
Revision as of 10:53, 9 September 2015 by Karl Jones (Talk | contribs)

Jump to: navigation, search

XMLHttpRequest (XHR) is an API available to web browser scripting languages such as JavaScript.

Description

XMLHttpRequest is used to send HTTP requests or HTTPS requeststo a web server, and load the server response data back into the script. The script can then use the response data to update the Document Object Model.

Development versions of all major browsers support URI schemes beyond http and https, in particular, blob URLs are supported.

Data from the response can be used to alter the current document in the browser window without loading a new web page

Despite the name of the API, this data can be in the form of not only XML, but also JSON, HTML or plain text.

The response data can also be evaluated by client-side scripting. For example, if it was formatted as JSON by the web server, it can be converted into a client-side data object for further use.

Ajax

The Ajax web development technique used by many websites to implement responsive and dynamic web applications depends on XMLHttpRequest.

Same-origin policy

For security reasons, XMLHttpRequest requests follow the browser's same-origin policy, and will therefore only succeed if they are made to the host that served the original web page.

See also

External links