jquery refreshes the implementation code of the page (local and full page refresh) _jquery

Source: Internet
Author: User
Tags getscript
Local refresh:

This method is more go, common have the following several;

$.get method, $.post method, $.getjson method, $.ajax method is as follows

The first two ways are basically the same
Copy Code code as follows:

$.get ("default.php", {ID: "1″, Page:" 2″},
function (data) {
Here is the callback method. Returns data. Here's how to deal with it.
});

$.getscript Method:
Copy Code code as follows:

$.getscript ("Http://jqueryajax.com/jquery.js",
function () {
$ ("#go"). Click (function () {//callback method
$ (". Block"). Animate ({backgroundcolor: ' Pink '}, 1000)
. Animate ({backgroundcolor: ' Blue '}, 1000);
});
});

$.getjson just returned a different type of data
Copy Code code as follows:

$.getjson ("default.php", {ID: "1″, Page:" 2″},
function (data) {
Note that the JSON data reference method returned here is "Data.info", and it is not clear that you can check out the JSON tutorial. There's not much to explain here.
});

$.ajax This method is estimated to use a lot of people. But I don't like to use it very much. Personally think the front two more convenient
Copy Code code as follows:

$.ajax ({
Type: "POST",//Submitted types
URL: "some.php",//Submit Address
Data: "Name=john&location=boston",//Parameter
Success:function (msg) {//callback method
Alert ("Data Saved:" + msg);//This is the content of the method, like the Get method above
}
});

The full page Refresh method is described below: sometimes you might use
Window.location.reload () refreshes the current page.
Parent.location.reload () Refreshes the Father object (for frames)
Opener.location.reload () Refreshes the parent window object (for a single open window)
Top.location.reload () Refreshes the topmost object (for multiple windows)

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.