Implementation Code of jquery page refreshing (partial and full page refreshing)

Source: Internet
Author: User
Tags getscript

Partial Refresh:

This method is much more common;

$. Get method, $. post method, $. getJson method, $. ajax method is as follows

The first two methods are basically the same.
Copy codeThe Code is as follows:
$. Get ("Default. php", {id: "1", page: "2 ″},
Function (data ){
// Here is the callback method. Return data. How can this problem be solved.
});

$. GetScript method:
Copy codeThe Code is as follows:
$. GetScript ("http://jqueryajax.com/jquery.js ",
Function (){
$ ("# Go"). click (function () {// callback Method
$ (". Block"). animate ({backgroundColor: 'pink'}, 1000)
. Animate ({backgroundColor: 'blue'}, 1000 );
});
});

$. GetJson only returns different data types
Copy codeThe Code is as follows:
$. GetJson ("Default. php", {id: "1", page: "2 ″},
Function (data ){
// Note that the JSON Data Reference Method returned here is "data.info". If you do not understand it, check the json tutorial. I won't explain much here.
});

$. Ajax is probably used by many people. But I don't like this very much. I personally think the first two are more convenient.
Copy codeThe Code is as follows:
$. Ajax ({
Type: "POST", // type of submission
Url: "some. php", // submit address
Data: "name = John & location = Boston", // Parameter
Success: function (msg) {// callback Method
Alert ("Data Saved:" + msg); // the content of the method is the same as the get method above.
}
});

The following describes how to refresh the entire page:
Window. location. reload () refresh the current page.
Parent. location. reload () refresh the parent object (for frame)
Opener. location. reload () refresh the parent window object (used for single-open window)
Top. location. reload () refresh the top object (used to open multiple Windows)

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.