The role of JavaScript Ajax, the process, and how to set the request header

Source: Internet
Author: User

Tag: Ike server error URL www redirect LAN benefit str request

What is Ajax? What is the role of it? What are the benefits of this process? How to set the request header???????? ( hehe, don't know please look down oh ):

  1) What is Ajax?

Ajax, "asynchronous Javascript and XML" (Asynchronous JavaScript and XML), refers to a web development technique that creates interactive Web applications.

  2) What is the role of Ajax?

Ajax enables Web pages to be updated asynchronously by exchanging small amounts of data in the background with the server. This means that you can update a part of a webpage without reloading the entire page.

In layman's terms: it's a technique for creating fast, Dynamic Web pages, and it's a technique to update parts of a Web page without reloading the entire page.

  3) But what are its benefits?

1, the user experience is particularly good

2, greatly improve the efficiency

3, no refresh dynamic loading data

  4) What is the process of Ajax?

1. Create an Ajax object (new XMLHttpRequest () | | | New ActiveXObject ("Microsoft, XMLHTTP"));

2, open (),//opens, it has three parameters (method of submission, address, true);

3, send ();//Submit

4. Monitor the status of the server (onreadystatechange)

  5) Set the request header

    setRequestHeader ("Content-type", "application/x-www-from-urlencoded")

Listen to some of the server's status code (hee, probably say some of the commonly used)

To establish the status of the connection:

0: Non-initialization of the representative;

1: the representative launches;

2: the Representative sends;

3: the Representative accepts;

4: the representative completes;

Feedback from the server:

100: Indicates that the customer must continue to make the request;

200: Indicates a successful request;

300: Indicates redirection;

400: Indicates a client error;

500: Indicates a server error;

said so much is to encapsulate Ajax to pave the way, but how exactly encapsulated Ajax??? I'll tell you a little bit like I did (hehe) 

The role of JavaScript Ajax, the process, and how to set the request header

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.