$ (function ()
{
Total pages
var totalpage=$ ("#totalPage"). html ();
Get page Information
var everpage=$ ("#everPage"). html ();
var currentpage=$ ("#currentPage"). html ();
var totalcount=$ ("#totalCount"). html ();
//Select Current page Settings
for (Var i=1;i<=totalpage;i++) {
$ ("#currentSelect"). Append
("<option value=" +i+ " > "+i+" </option> ")
}
//Click Current Page Event
$ (" #currentbt "). DblClick (function () {
$ (" # CurrentPage "). Hide ();
$ ("#currentSelect"). Show ();
})
//Select the current page Change event
$ ("#currentSelect"). Change (function () {
var currentpage=$ (this). Val ();
Sets the current page
$ ("#inCurrent"). Val (currentpage);
Control page Jump
$ ("#pagefrom"). Submit ();
})
//Paging operation
$ ("#pagetable th"). Click (function (e)
{
//Get click Element ID
var activetd=$ ( This). attr ("id");
//Whether there is a next page
var pagedown=$ ("#pageDown"). html ();
//have previous page
var pageup=$ ("#pageUp"). html ();
Next page
if (activetd== "PAGEDOWNBT" &&pagedown== "true")
{
$ ("#usertable TD"). HTML ("");
currentpage++;
Pageoperate ();
}
//Previous
if (activetd== "PAGEUPBT" &&pageup== "true")
{
$ ("#usertable TD"). HTML ("");
currentpage--;
Pageoperate ();
}
});
/********************** Page Operation Method strat***********/
function Pageoperate ()
{
Ajax post transfer value to background
$.post ("PageUp", {everpage:everpage,currentpage:currentpage,totalcount:totalcount},
function (data)
{
Parsing JSON data strings
var dataobj=$.parsejson (data);
Get Userjson
var jsonuser = Dataobj.userinfo;
Get Pagejson
var jsonpage=dataobj.page;
Update page data
$ ("#currentPage"). HTML (jsonpage.currentpage);
$ ("#pageUp"). HTML (jsonpage.pageup);
$ ("#pageDown"). HTML (Jsonpage.pagedown);
To re-spread the JSON data on the table
for (Var i=0;i<totalcount;i++)
{
$ (". TD1"). EQ (i). html (jsonuser[0][i].username);
$ (". Td2"). EQ (i). html (Jsonuser[0][i].password);
$ (". Td3"). EQ (i). html (jsonuser[0][i].truename);
$ (". Td4"). EQ (i). html (jsonuser[0][i].job);
$ (". Td5"). EQ (i). html (jsonuser[0][i].power);
}
});
}
/********************** Page Operation Method end***********/
})
Static paging Ajajx +json