jquerymobile知识点五:动态Grid的绑定以及刷新

本文提供了一个jQueryMobile使用AJAX进行动态绑定和刷新的具体实例,包括初始绑定函数实现,通过POST请求获取数据,并成功处理并展示商品列表。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

       下面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();
    }

希望对初学者有所帮助。。。。

     

      








评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值