Difference between revisions of "XMLHttpRequest"

From Wiki @ Karl Jones dot com
Jump to: navigation, search
(First)
 
Line 7: Line 7:
 
Data from the response can be used to alter the current document in the browser window without loading a new web page
 
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.
+
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.
 
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.
  
The Ajax web development technique used by many websites to implement responsive and dynamic web applications depends on XMLHttpRequest.
+
The [[Ajax (programming)|Ajax]] web development technique used by many websites to implement responsive and dynamic web applications depends on XMLHttpRequest.
  
 
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.
 
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.

Revision as of 12:40, 24 May 2015

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

It is used to send HTTP or HTTPS requests to a web server and load the server response data back into the script.

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.

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

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.

External links