Jquery refreshes the page implementation code (partial and full page refreshes). For more information, see. 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.
The 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:
The 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
The 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.
The 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)