XMLHttpRequest object in AJAX

Source: Internet
Author: User

Instructor Wang xingkui's video has already been read, and this part of the summary work has not yet begun. He has not summarized new knowledge points or not very clear knowledge in a timely manner, I just listed all the content I want to summarize in Onenote. Now I will go back and summarize it a little bit. This blog is a summary of the XMLHttpRequest object, before summarizing the XMLHttpRequest object, let's review what AJAX is and why we want to use it.

I was a little ashamed of myself. On that day, I was asked about the full name of AJAX. When I thought about the cooperation of the data center charging system, the teacher asked me about the full name of UML, in fact, I understand what I mean, but it means that I don't have a deep understanding of this thing. I remember the comfort I gave myself at that time when the teacher suddenly asked me this question, and I was nervous, so I didn't say it. This time I was asked by Xue min, I was still nervous when we were playing together every day? I think that the root cause why I did not say it was not tension, but I did not pay attention to it, or even did not understand it deeply, so when someone asks me, I feel confused and don't know what to say. In the end, it comes to my learning methods and learning efficiency. I am too rigid to apply what I have learned. Okay, let's get down to the truth.

AJAX is "Asynchronous JavaScript and XML" (). AJAX is not a acronym, but a term created by Jesse James Gaiiett. It is a web development technology used to create interactive web applications. We all know that ajax is not a new technology, but a combination of several original technologies. It is composed of the following technologies.

In the above technical procedures, all technologies except XmlHttpRequest objects are based on web standards and have been widely used. It is already a de facto standard, because almost all mainstream browsers currently support it, it is the core of AJAX

XMLHttpRequest is the object of the XMLHttp component. With this object, Ajax can exchange data layers with the server just like a desktop application, instead of refreshing the interface every time, you do not have to hand over data processing to the server every time. This reduces the load on the server and recalls the response speed, and shortens the user's waiting time.

= Function () {if (tempxmlhttp. === 4) {if (tempxmlhttp. === 200) {var responseText = tempxmlhttp .; var responseXML = tempxmlhttp .; if (callback = undefined | callback = null) {alert ("no correct method is set for data processing! "); Alert (" returned data: "+ responseText);} else {callback (responseText, responseXML );}} else {if (failback = undefined | failback = null) {alert ("no processing method is set for failed data processing! "); Alert (" HTTP Response Code: "+ tempxmlhttp. status + ", response code text:" + tempxmlhttp. statusText);} else {failback (tempxmlhttp. status, tempxmlhttp. statusText );}}}};


(Method, url, true); // if it is POST, you need to set the request header if (method = "POST") {this. xmlhttp. ("Content-Type", "application/x-www-form-urlencode");} this. xmlhttp. (data);} else {alert ("XMLHttpRequest object creation failed, unable to send data! ") ;}}; MyXMLHttpRequest. prototype. abort = function () {this. xmlhttp .();};


Since the emergence of computers, desktop software has always been an absolute dominant position, but the emergence and success of the Internet have led to a subtle change. A considerable number of people believe that sooner or later, data and computer software will be transferred from the desktop to the Internet. That is to say, in the future, computers may discard heavy hard disks and directly obtain data and services from the Internet. although it seems that we are still far away from this day and there are still many problems to solve, I think this is not a dream, but a reality that will be realized sooner or later. The main problem is that the connection to the Internet is unstable, and no one wants to watch their computers download 1.1 drops of data from the server. Does ajax solve this problem, instead of solving this problem, ajax simply masks the problem. It serves as a buffer between the server and the client, making the user mistakenly think that the service is not interrupted. To be precise, ajax does not speed up downloading data from the server, but does make the wait less frustrating. However, this is enough to have a huge impact and vibration. It actually has a huge impact on desktop software.


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.