Ajax

Ajax stands for "A synchronous  Javascript And  X ML " (asynchronous JavaScript and XML), which refers to a web development technology for creating interactive web applications. Ajax = Asynchronous javascript and XML (a subset of Standard Common Markup Language). Ajax is a technique for creating fast and dynamic web pages. Ajax is a technique for updating parts of a web page without reloading the entire web page.  Ajax enables web pages to be updated asynchronously by exchanging small amounts of data with the server in the background. This means that parts of a page can be updated without reloading the entire page. Traditional web pages (without using Ajax) must reload the entire web page if the content needs to be updated.
Ajax features:
      1. Ajax is not a new programming language, but a technology for creating better, faster and more interactive web applications.
      2. Use JavaScript to make a request to the server and process the response without blocking the user! The core object XMLHTTPRequest. Through this object, your JavaScript can exchange data with the web server without reloading the page, that is, a partial refresh effect can be produced without needing to refresh the page.
      3. Ajax uses asynchronous data transfer (HTTP request) between the browser and the web server, so that the web page requests a small amount of information from the server instead of the entire page.
      4.Ajax can make Internet applications smaller, faster and more friendly.
How AJAX Works
How Ajax works:
     1. Ajax is a browser technology independent of Web server software. Ajax is based on the following web standards:
     2. JavaScript, XML HTML and CSS Web standards used in Ajax are well defined and supported by all major browsers. Ajax applications are browser and platform independent.
     3. Web applications have many advantages over desktop applications; they can reach a wide range of users, they are easier to install and maintain, and they are easier to develop.
     4. However, Internet applications are not as complete and friendly as traditional desktop applications. With Ajax, Internet applications can become more sophisticated and friendly.

  Traditional web pages do not use Ajax technology. When the content of the web page is updated, the page needs to be reloaded to rewrite the page. If it is the entire website, the workload is undoubtedly huge, but with Ajax technology, when we design the form in the background, add Related code, asynchronous input and output, local update, which makes the work easier. For example, many well-known websites, such as Tencent, Sina, Google, Baidu Maps, etc., all use this technology.

  To learn Ajax technology, it is enough to have the basics of HTML, CSS, and JS.

  Traditional synchronous loading is crazy because one object is missing, and that is the XMLHttpRequest object. With this object, the data exchange between the background and the server can be realized, and the partial request and refresh of the page can be achieved. This is the asynchronous function of Ajax.

  What we need to do to achieve this functionality is:

1: Use HTML and CSS to write pages to express information.

2: Asynchronous exchange of data with XMLHttpRequest and Web server.

3: Use javascript to operate the DOM to achieve dynamic local refresh.

  The important thing is the second point, how to create an XMLHttpRequest object?

  It's the following sentence:

var request=new XMLHttpRequest();

  But IE5 and IE6 are not compatible.

  So write it like this:

var request;

If(window.XMLHttpRequest){

request=new XMLHttpRequest();

}else{

request=new ActiveXObject(“Microsoft.XMLHTTP”);//IE6,IE5

}

That is, if there is a definition of XMLHttpRequest, use it directly, if not, create an ActiveXObject object and use it. 

The Ajax flow is like this:

1. Get the required data from the web form.

2. Establish the URL to connect to.

3. Open a connection to the server.

4. Set the function to be run by the server after completion.

5. Send the request.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324448833&siteId=291194637