Ajax implementation-javascript

Source: Internet
Author: User

I don't think we need to make too many comments about the advantages of Ajax technology. ajax technology is now widely used in web applications, such as google Maps and provincial/municipal connections.

AJAX = Asynchronous JavaScript and XML.

AJAX is a technology for creating fast dynamic web pages.

AJAX allows asynchronous updates on webpages by exchanging a small amount of data with the server in the background. This means that it is possible to update part of the webpage without reloading the whole page.

I am not talking about it. Now I will use pure javascript to implement ajax technology.

The first is the jsp page:

<Html> 

The servlet on the server side is very simple, that is, a piece of text content is returned to the client.

The core of ajax technology isXmlHttpRequest,For IE, because its kernel is different from other browsers (Firefox, Chrome), you must first determine whether the browser is IE

If (window. activeXObject) // IE browser {xmlHttpRequest = new ActiveXObject ("Microsoft. XMLHTTP ");} else if (window. XMLHttpRequest) // other browsers except IE {xmlHttpRequest = new XMLHttpRequest ();}

After xmlHttpRequest is obtained, the subsequent operations are reflected in the Code above. The process is nothing more than sending a request like a servlet, and then calling the callback function according to the change in response status, finally, the server obtains the response data, which can be xml, json, or plain text,

Related Article

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.