JQuery namespace and closing method

The example of this paper tells the jQuery namespace and closing method. Share to everyone for reference, specifically:

/ * * Service company user summary, audit * / (function () {“use strict”; var companylist = new Object (); // Declaration Name Space // Timestamp formatted for time companyList.getlocaltime = function (ns) {Return New Date (Parseint (NS)). Tolocalestring (). Substr (0,17);} // Energy Saving Service Company User List Var Keywords_pagenumber = 1; CompanyList.getCompanyUser = function () {var URL = “/ PTSP / REST / COMPANY / Register / List”; $ .GET (URL, {thispage: keywords_pagenumber}, function (data) {Console.Log (data.data.rows); console.log (data.data.pagination); if (data.success) {var result = data.data.rows; var code = “”; for (var i = 0; i “+”
 "+ Obj [1] +"  "+" <result.length;i++){
       for(var i in result){
        var obj=result[i];
        var address=obj[5]+obj[6];
        var sta=obj[8];
        var txt=""
        if("WAIT"==sta){
        txt="待审核";
        }else if("YES"==sta){
        txt="已审核";
        }else if("NO"==sta){
        txt="不通过";
        }
        code +=" "+ OBJ [2] +"  "+"  "+ address +"  "+"   View  "+"  "+ TXT + "" + "" + CompanyList.getlocaltime (Obj [9]) + "" + "  review  " + "" ;.}} $ ( "# companyInfo") html (code); // tab keywords_pagenumber = data.data.pagination.thisPage; var keywords_pagesize = data.data.pagination.pageRange; var dataSize = data.data.pagination.dataSize ; var totalpage = Math.ceil (dataSize / keywords_pagesize); $ ( "# exp_keywords_page") pageBar ({PageIndex:. keywords_pagenumber, // this page PageSize: keywords_pagesize, // number of records per TotalPage: totalpage, // total pages number RecordCount: dataSize, the total number of data // // isShowPageNumber: false, onPageClick: function (page) {keywords_pagenumber = page; companyList.getCompanyUser ();}});}});} $ (document) .ready (functION () {Console.log ("Check Register User"); // Energy Saving Service Company User List CompanyList.getCompanyUser ();}); // Submit $ ('# modalform1'). Ajaxform (Function (jsonResult) {IF (JSONRESULT.SUCCESS) {Alert ("Save Success!"); Window.Location.Reload ();} else {Alert (JSONRESULT.MSG);}});};      Note: jQuery's namespace is a class similar to CSS instead of Package similar to Java. JS closure concept is very simple, that is, the function is used to use external variables, and you can get it. 
More about JQuery Related Contents Readers can view this site: “jQuery common event usage and skill summary”, “jQuery common plugin and usage summary”, “jQuery extension skill summary” and “jQuery” Summary of selector usage “

It is hoped that this article is designed to help you jQuery program.

© Copyright Notice
THE END
Just support it if you like
like0
share
comment Grab the couch

Please log in to comment