Jtemplate is a jquery based template engine plug-in, the function is very powerful, with her you will no longer have to use JS binding data sets and worry about.
Main idea, copy textarea as template, Ajax load JSON data, add templates, bind data, update load more events.
Load more function Fnload (data) {Listdata.ajax.data.target_page=parseint (data.currentpage) +1; function Addmore () {
ListData.Ajax.load (); ///Dynamic Transform load more tags if (data.totalnums = 0) {$ ("#loadOBj"). AddClass ("font-disable"). HTML ("not yet entered data!")
"). Unbind (" click ");} if (Data.hasnext) {$ ("#loadOBj"). HTML ("load more"); if (data.currentpage==1) {$ ("#loadOBj"). Bind ("click", Addmore);} else{$ ("#loadOBj"). AddClass ("font-disable"). HTML ("It's already the bottom!").
"). Unbind (" click ");} Ajaxcallback function callbacklist (data) {var nexthtml = $ (' #listTemplate '). Prop ("outerhtml"); var $listObj = Listpage ==0?
' #listObj ': ' #listObj ' +listpage;
var $nextListObj = ' listobj ' + (listpage+1);
$ ($LISTOBJ). Settemplateelement (' ListTemplate ', null,{filter_data:false});
$ ($LISTOBJ). SetParam ("Imgdomain", Roomimgdomain);
$ ($LISTOBJ). ProcessTemplate (data);
$ ($LISTOBJ). After ($ (' <div></div> ', {ID: $NEXTLISTOBJ, class: ' List-wrap '});
$ (' # ' + $nextListObj). Append (nexthtml);
listpage++;
var $firstH 3 = $ ("#listObj. View-box:first H3″); $firstH3.next (). Show ();
$firstH 3.find ("span"). AddClass ("h3-up"). Removeclass ("H3-down");
Fnload (data);
}
}); //ajax $Ajax. prototype.load = function () {var _this = this; $.ajax ({type: "post", url: _this.url, DataType: ' JSON ', data : _this.data, Success:function (data) {if (_this.callback) {_this.callback (data, _this.id);} else{//console.log ("Ajax does not define callback functions!")
");}}, Error:function () {//console.log (" Ajaxerror ");}); Call Function Fnlistajax () {this.
Ajax = new $Ajax (); This.
Ajax.url = ""; This.
Ajax.data = {};
var listdata = new Fnlistajax ();
Fnajax ();
function Fnajax () {ListData.Ajax.url = datadomain+ "/advert/detail.htm"; listData.Ajax.data = {code: ' Index_web '};
ListData.Ajax.callBack = Fncallbackview;
ListData.Ajax.load (); };
The above content for you to share the Ajax +jtemplate implementation dynamic paging, I hope you like.