Dry for a while, it is time to summarize, the main summary of the technology used at the front desk. The areainfo.js data is defined as follows:
{"Arealist": [ { "name": "Beijing", "num": 123 }, { "name": "Nework", "num": 124 } ] }
---------------------
Front Desk Simple code is as follows, mainly used to Template.js and Jquery.js, Test1.js:
------test1.js-----
$ (document). Ready (function () { $.ajax ({ URL: "Js/data/areainfo.js", //data: {' Inputs ': Data}, DataType: "JSON", type: "GET", Async:false, success:function (JSON) { if (JSON). Arealist! = null && JSON. Arealist.length > 0) { var items = template (' Arealst-tpl ', JSON); $ (' #tb-list '). empty (); $ (' #tb-list '). HTML (items); } else { alert ("No Data") ,} , error:function (Error) { console.log (error);});} );
Logic is very simple, Ajax request the definition of JSON data, and then call template code, formatted data display form a list of data, similar to the JSP is very convenient.
List of templates