Deep Analysis ajax--Series (i)

Source: Internet
Author: User

A person who often writes scripts. Sometimes use $ajax, sometimes also use $post and $get, these methods are used to get static data files from webserver.

jquery encapsulates Ajax operations, where the $.ajax () method is the lowest-level method in jquery, and the 2nd layer is the load (), $.get (), and $.post () methods. The 3rd layer is the $.getscript () and $.getjson () methods.

1)$.ajax () This method believes that we are not unfamiliar, at the bottom. The most versatile.

2) The load () method is the simplest and most frequently used AJAXFANGFA in jquery, which can load remote HTML code and insert it into the DOM.

A) examples are as follows:

$ (function () {$ ("#send"). Click (function () {$ ("#resText"). Load ("test.html");});

b) also be able to filter the contents of the load, such as only need to load the contents of the Test.html page class para:

$ ("#resText"). Load ("test.html  . para");


c) In addition, the way of transmission is particularly noteworthy, assuming that there is no reference to the pass time, then the Get method is passed, assuming that there is a reference to the post method of passing


D) The three callback parameters of its callback function should also be noted, for example.

$ ("#resText"). Load ("test.html", function (responsetext,textstatus,xmlhttprequest) {//responsetext   : Request returned content// Textstatus:       Request Status: Success, error, notmodified, timeout 4 kinds of//xmlhttprequest:xmlhttprequest objects});

Deep Analysis ajax--Series (i)

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.