This is the code for Jquerty
/** Global Variables*/ varindex = 1; varTotalpage = 0; /** Pagination Form Events*/ $(function () { /** Take the total number of bars uploaded from the servlect to the JSP page to the global variable totalpage assignment * The current page and the total number of pages in the JSP page are displayed in code * <span id= "index ">1</span>\<span id=" Totalpage ">${requestScope.senior.totalPage}</span>*/Totalpage=$ ("#totalPage"). html (); //Home Page$ (' #firstpage '). Click (function () { if(Index! = 1) {Index= 1; Paging ();/** Click the paging asynchronous Refresh function*/ } return false; }); //last page$ (' #lastpage '). Click (function () { if(Index! =totalpage) {Index=Totalpage; Paging (); } return false; }); //Previous Page$ ("#beforepage"). Click (function () { if(Index! = 1) {Index= Index-1; Paging (); } return false; }); //Next Page$ ("#nextpage"). Click (function () { if(Index <totalpage) {Index= index + 1; Paging (); } return false; }); }) /** Click Pagination*/ functionpaging () {Ajaxbase ("Varietymanyservlet?method=paging", "index=" +index, "Inturn"); /** Assign value to page display current page*/ $("#index"). HTML (index); }/** Ajax function Tool class * @param URL: Address * @param data: Request Parameter * @param method: Methods signal, function to determine what to do */ functionAjaxbase (Url,data,method) {$.ajax ({type:' Post ', URL:"' +url+ ', Cache:false, Data:data, DataType:' Text ', Success:function(Result) {alert ("Ajax function Tool class: Success"); /** Call the operation function after successful login*/success (Result,method); }, Error:function() {alert ("Ajax function Tool class: Error"); } }); }/** Determine what to do based on the method signal * @param result: Data of the server response * @param method: Methods signal, action to determine what to do */ functionSuccess (Result,method) {if(method== "Inturn"){ /** * Dynamically add data in Easyui*/ $(' #MyTable '). DataGrid (' LoadData ', {total:0,rows:[]});//empty all the data in the DataGrid! Do not include field column names varData=eval ("(" +result+ ")");//JSON data to convert the response //iterates through the JSON collection to dynamically append tabular data. --Two ways to traverse. for(varMachineinchdata) { varRow_data={box:' <input type= ' checkbox '/> ', Nickname:data[machine].nickname, Ordinaryprice:data [Machine].ordinaryprice, Memberprice:data[machine].memberprice, Quantity:data[machine].sale.quantity, grade:data[machine].commentss[0].grade, Path:", add:' <a name= ' show ' onclick= ' ShowDetail (' +data[machine].id+ ') ' > Query details </a> ' + ' &L T;a name= "Check" onclick= "Checklgoin (' +data[machine].id+ ', ' +$ (" Input[name=checkhidden] "). Val () + ')" > Add to Cart </ A> ' }; $("#MyTable"). DataGrid (' Appendrow ', Row_data); }
Ajax asynchronous Refresh paging feature-mysql