Ajax is all called "Asynchronous JavaScript and XML" (Asynchronous JavaScript and XML), a Web development technology that creates interactive Web applications. Ajax technology is a collection of all the techniques currently available in the browser through JavaScript scripts. Ajax in a new way to use all of these technologies, so that the ancient B/S mode of web development has been revitalized.
Among Ajax technologies, the core technology is XMLHttpRequest, its original name called XMLHTTP, which Microsoft pioneered in 1999 in IE5.0 browsers to meet the needs of developers. This technique was later named XMLHttpRequest by the above specification. It's where Ajax technology is different. In short, XMLHttpRequest provides a means of communicating with the server within a page for JavaScript scripts running in browsers. JavaScript on the page can fetch data from the server without refreshing the page, or submit data to the server. The advent of XMLHttpRequest provides a new possibility for web development, and even changes the way people think about how web apps are made up. It enables us to do web development in a completely new way, providing users with a better interaction experience.
Unlike traditional web development, Ajax does not look at Web applications in a static-page way. From an AJAX perspective, Web applications should consist of a small number of pages, each of which is actually a smaller AJAX application. Each page includes some AJAX components that are developed using JavaScript. These components use the XMLHttpRequest object to communicate asynchronously with the server, and then use the DOM API to update part of the page after retrieving the required data from the server. So the difference between AJAX applications and traditional Web applications is mainly in three places:
1. Do not refresh the entire page and communicate with the server within the page.
2. Use asynchronous mode to communicate with the server, do not need to interrupt the user's operations, with more rapid response capabilities.
3. The application is composed of only a few pages. Most of the interaction is done within the page without having to switch the entire page.
This shows that Ajax makes Web applications more dynamic, brings higher intelligence, and provides a rich Ajax UI component. Such a new kind of web application is called RIA (Rich Internet application) application.
In front of me on the Internet to find some information on the introduction of Ajax to help readers who do not know Ajax technology as soon as possible to understand Ajax technology, the following I will be in the actual development of the use of some of the Ajax technology and skills to introduce you.
The most important thing to use AJAX technology is to create XMLHttpRequest objects, and there's a lot of information on how to create the object online. One of my most common methods is
function Createxmlhttprequest () {
var xmlhttp;
try {
xmlhttp = new ActiveXObject('Msxml2.XMLHTTP');
} catch(e) {
try {
xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');
} catch(e) {
try {
xmlhttp = new XMLHttpRequest();
} catch(e) {
alert("创建XMLHttpRequest对象失败!");
}
}
}
return xmlhttp;
}