$.ajax({
            type: "get",//使用get方法访问后台
            dataType: "json",//返回json格式的数据
            url: "BackHandler.ashx",//要访问的后台地址
            data: "pageIndex=" + pageIndex,//要发送的数据
            beforeSend : function(){ },
            complete :function(){$("#load").hide();},//AJAX请求完成时隐藏loading提示
            success: function(msg){//msg为返回的数据,在这里做数据绑定
                var data = msg.table;
                $.each(data, function(i, n){
                    var row = $("#template").clone();
                    row.find("#OrderID").text(n.订单ID);
                    row.find("#CustomerID").text(n.客户ID);
                    row.find("#EmployeeID").text(n.雇员ID);
                    row.find("#OrderDate").text(ChangeDate(n.订购日期));
                    if(n.发货日期!== undefined) row.find("#ShippedDate").text(ChangeDate(n.发货日期));
                    row.find("#ShippedName").text(n.货主名称);
                    row.find("#ShippedAddress").text(n.货主地址);
                    row.find("#ShippedCity").text(n.货主城市);
                    row.find("#more").html("<a href=OrderInfo.aspx?);//添加到模板的容器中
       },
       error: function (XMLHttpRequest, textStatus, errorThrown) {
           // 通常 textStatus 和 errorThrown 之中
           // 只有一个会包含信息
           this; // 调用本次AJAX请求时传递的options参数
      }
  
            });

相关文章:

  • 2022-02-10
  • 2021-07-02
  • 2022-01-11
  • 2022-02-12
  • 2021-12-18
  • 2021-09-29
猜你喜欢
  • 2021-06-12
  • 2021-06-16
  • 2021-11-15
  • 2021-12-19
  • 2022-02-22
  • 2022-02-07
相关资源
相似解决方案