标签:
下面jquerymobile是ajax动态绑定和刷新的例子。直接上图以及代码。
下面是实例代码:
//初始绑定 function GetInitBind(PageIndex, PageSize, sqlwhere, OrderType) { showLoading(); var adapGrid = $("#adapGrid"); $.ajax({ type: "POST", url: "/Ashx/YouHui.ashx?MethodName=GetSealsList&PageSize=" + PageSize + "&PageIndex=" + PageIndex + "&date=" + new Date().getTime() + "&SqlWhere=" + sqlwhere + "&OrderType=" + OrderType, data: "", dataType: "json", success: function (data) { data = eval(data); var strleft = ""; $.each(data.List, function (i, item) {//打折商品列表 if (i % 2 == 0) { strleft += "<div class=‘ui-block-a‘ style=‘height:100%‘>"; strleft += "<img style=‘width:99%;‘ src=‘" + item.YouhuiFilepath + "‘/>"; strleft += "<a class=‘descriptions‘>"; strleft += "<p>剩余时间:" + unescape(item.Day) + "</p>"; strleft += "</a>"; strleft += "</div>"; } else { strleft += "<div class=‘ui-block-b‘ style=‘height:100%‘>"; strleft += "<img style=‘width:99%;‘ src=‘" + item.YouhuiFilepath + "‘/>"; strleft += "<a class=‘descriptions‘>"; strleft += "<p>剩余时间:" + unescape(item.Day) + "</p>"; strleft += "</a>"; strleft += "</div>"; } }); adapGrid.append(strleft).trigger("create");//重要(刷新) }, error: function (data) { // $("#goodlist").html("数据有误!"); } }); hideLoading(); }
标签:
原文地址:http://www.cnblogs.com/dekevin/p/4220476.html