Share the code for creating a simple instance Using Ajax,

Source: Internet
Author: User

Share the code for creating a simple instance Using Ajax,

XmlHttp is a set of APIs that can be transmitted over http or receive XML and other data in Javascript, VbScript, Jscript, and other scripting languages. XmlHttp can be used to update part of the webpage without refreshing the entire page. Almost all browsers support XMLHttpRequest objects, which are the core technology of Ajax applications.
The js Code is as follows:

<Html> 

Explanation of the above js Code:
(1). XMLHttpRequest objectOnreadystatechange attribute. When a request is sent to the server, the task needs to be executed. When the readyState changes, the onreadystatechange event is triggered.
(2). XMLHttpRequest objectThe readyState attribute of, containing the status of XMLHttpRequest (0 ~ 4 ).

  • 0: the request is not initialized.
  • 1: The server connection has been established.
  • 2: The request has been received
  • 3: The request is being processed
  • 4: The request is complete and the response is ready.

(3). open (method, url, async) method: Specifies the request type, URL, and whether to asynchronously process the request.
(4). send (content)Send a request to the server.

The above is the code for creating simple Ajax instances. I hope it will be helpful for your learning. You can also create simple Ajax instances by yourself.

Articles you may be interested in:
  • Perfect compatibility code for creating XMLHttp objects using Ajax
  • How to Use ajax to create an XMLHttpRequest object
  • Jquery creates an ajax keyword data search implementation idea
  • Jquery + ajax + C # simple instance for refreshing database data
  • Simple Example of JQuery Ajax request to implement partial refresh
  • Js dynamically creates upload forms using iframe to simulate Ajax to achieve no refreshing
  • Php ajax simple example
  • Php + ajax refresh simple instances in real time

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.