zoukankan      html  css  js  c++  java
  • jquery之ajax


            $.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?id=" + n.订单ID + "&pageindex="+pageIndex+">&nbsp;More</a>");                   
                        row.attr("id","ready");//改变绑定好数据的行的id
                        row.appendTo("#datas");//添加到模板的容器中
           },
           error: function (XMLHttpRequest, textStatus, errorThrown) {
               // 通常 textStatus 和 errorThrown 之中
               // 只有一个会包含信息
               this; // 调用本次AJAX请求时传递的options参数
          }
      
                });

  • 相关阅读:
    Python集合(set)类型的操作
    3GPP接口定义及相关协议一览
    OSS基本概念介绍
    建造者模式(Builder Pattern)
    组合模式(Composite Pattern)
    观察者模式(Observe Pattern)
    ReentrantLock
    <logger>和<root>
    logback的configuration
    logback的加载过程
  • 原文地址:https://www.cnblogs.com/andydao/p/3049293.html
Copyright © 2011-2022 走看看