Ajax asynchronous Refresh paging feature-mysql

Source: Internet
Author: User

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

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.