Ajax (i) Introduction and basics of Ajax

Source: Internet
Author: User

This section introduces (asynchronous linked server object) XMLHttpRequest and an introduction to Ajax.

Ajax is "Asynchronous JavaScript and XML" (Asynchronous JavaScript and XML). AJAX has four benefits: 1. That reduces the burden on the server. 2 brings a better user experience. 3. Standards-based support is widely available. 4. Have better page rendering and data separation.

Technical name Technical notes
Javascript JavaScript is a generic scripting language, and Ajax is written in JavaScript.
Css User interface styles are modified by CSS
Dom Dom modifies dom,ajax through JavaScript to change the user interface at run time, or to partially update a node in a page.
XMLHttpRequest The XMLHttpRequest object XMLHttpRequest object allows web programmers to retrieve data from the Web server in the background. The number of data is usually either XML or text.

From the above we can see that JavaScript is like glue to paste the various parts together, for example, through the JavaScript operation BOM change Refresh user interface, modify the classname to change the style of CSS style

Not strictly speaking, Ajax is a simple multi-threaded, it can be a user in the foreground a variety of operations without interruption. Ajax asynchronous interactions work silently in the background the asynchronous access in the Web is implemented by the XMLHttpRequest object, which was first introduced as an ActiveX control in IE5. Then each browser supports the asynchronous object, and the object must first be created. The code is as follows:

    var xmlHttp;            function Createxmlhrrprequest () {                if (window. ActiveXObject)                    xmlHttp = new ActiveXObject ("Microsoft.XMLHTTP");                else if (window. XMLHttpRequest)                    xmlHttp = new XMLHttpRequest ();            }

The object is first created with a global variable, XMLHTTP, to be used later in the function. Also create asynchronous object function Createxmlhrrprequest ()

This procedure uses the If statement method, if IE uses the Window.activexobject method, if not, the XMLHttpRequest method is used to create the function.

After the asynchronous object is created, it is natural to use the object to connect to the server, which has a series of very useful properties and methods.

(not to be continued)

Ajax (i) Introduction and basics of Ajax

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.