XMLHttpRequest

XMLHttpRequest ( XHR ) is a method for transmitting data via the HTTP protocol.

XMLHttpRequest allows a script to a web page dynamically retrieve data from the web server without the need for the HTML page needs to be reloaded. This was previously only possible through the use of invisible HTML frames or IFrames or dynamically reloaded script files. Since the XMLHttpRequest method, data is processed asynchronously, a script does not have to wait until the request is answered, but can be as long as to other activities.

With XMLHttpRequest all HTTP request methods can be used (among other things GET, POST, HEAD, PUT). If a request returns XML data, XMLHttpRequest can these alternative return as text or as a DOM tree. The latter is suitable for example to communicate with Web services. XMLHttpRequest forms a basic building block of the Ajax technique.

History

The XMLHttpRequest technology was originally developed by Microsoft and is available in Internet Explorer since version 5.0 as an ActiveX object. Many browsers support this API, the Internet Explorer browser are Mozilla and all other Gecko - derivatives (version 1.0), Opera (version 7.6 beta ) and Safari (version 1.2), Konqueror and KHTML all other derivatives.

As is apparent from the various interface specifications of the various XMLHttpRequest implementations, they are not completely compatible with each other. For this reason, a uniform definition of the XMLHttpRequest object by the W3C for standardization was proposed in December 2012.

The following example retrieves a resource on the same domain via XMLHttpRequest and returns the contents in a message window:

Var xmlHttp = null; try {      / / Mozilla, Opera, Safari and Internet Explorer ( v7 )      xmlHttp = new XMLHttpRequest (); } Catch (e ) {      try {          / / MS Internet Explorer ( v6 )          xmlHttp = new ActiveXObject ( " Microsoft.XMLHTTP ");      } Catch (e ) {          try {              / / MS Internet Explorer ( v5 )              xmlHttp = new ActiveXObject ( " Msxml2.XMLHTTP ");          } Catch (e ) {              xmlHttp = null;          }      } } if ( xmlHttp ) {      xmlHttp.open ( 'GET ', ' sample.xml ', true );      xmlHttp.onreadystatechange = function ( ) {          if ( xmlHttp.readyState == 4 ) {              alert ( xmlHttp.responseText );          }      };      xmlHttp.send ( null); } XMLHttpRequest Level 2

An extended specification of the W3C XMLHttpRequest has since January 2012 the status of a working draft ( working draft ). Planned are domain -wide queries that support data streams etc.

Swell

World Wide Web Consortium (W3C )

Canonical XML • CSS • CDF • DOM • Geolocation API • HTML • ITS • • OWL MathML P3P • • PLS • PNG • • RDF RDF Schema SISR • • • SKOS SMIL • SOAP • SRGS, SSML • • • SPARQL SVG • Timed Text • Turtle • VoiceXML • WSDL • XFormsXHTML • XHTML RDFa • XIncludeXLink • XML • XML Base • XML Encryption • XML Events • XML Information Set • XML namespace • XML Schema • XML Signature • XPath • XPointerXProc • • XQuery XSL XSL-FO • • XSLT ( elements )

• CCXML CURIEHTML5InkML • RIF • SCXML • SMIL Timesheets • sXBL WICD • • • XFDL XFrames • XBL • XHTML MathML SVG • XMLHttpRequest

XAdES • XHTML SMIL • XUP

Web Content Accessibility Guidelines • Multimodal Interaction Activity • Markup Validation Service

Web Accessibility Initiative

  • Programming
831500
de