简体   繁体   中英

The XMLHttpRequest object

I have a few questions about XMLHttpRequest.

  1. Is it true that this is not a Javascript object, but an object that is native to the browser? This is the first time I have heard of a browser having "native objects." What other native objects does a browser have?

  2. It seems that XMLHttpRequest existed before Ajax. If that is true, then what was it used for?

  3. It has 5 attributes: readyState, status, onreadystatechange, responseText, responsXml. Notice that these are all written in lower camel case, except for onreadystatechange. Why is that?

XMLHttpRequest first originated by IE, it was later also included in most other browsers including Firefox.

Back then, Microsoft had its own use of the XMLHttpRequest object.

It was only sometime in 2005 that the XMLHttpRequest object became "discovered", widely known and useful to be able to post data asynchronously to the server without holding user's browser.

The name AJAX was coined using XMLHttpRequest .

XMLHttpRequest is an enabler of AJAX, which is a combination of this object + XML + JS (Although these days you could arguably say JSON serves the job better than XML)

  1. Actually most of the build-in objects/types are native objects/types because of performance reasons, and some of them are native feature related so they have to be native objects/types. They just have JavaScript wrappers and can be accessed by JavaScript.

  2. XMLHttpRequest is the base of AJAX, AJAX is a buzz word raised by XHR and finally became a concept like "dynamic, fancy, user friendly client-side webpage".

  3. That's the naming convention of "event", like "onclick", "onmouseover". The camel case is for methods. The type convertion for types/classes is pascal case, eg, "XMLHttpRequest".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM