码迷,mamicode.com
首页 > Web开发 > 详细

简单的 ajax demo

时间:2017-04-05 13:11:39      阅读:318      评论:0      收藏:0      [点我收藏+]

标签:repo   vts   dht   cache   pil   vsp   kvo   word   acl   

2.最重要也是最核心的是要自己改下bootstrap-paginator.js源文件,如下:

[javascript] view plain copy 技术分享技术分享
  1.     function oneferReportrePaintLine(param,type,page){
            var time = param.name;
            var fareType =type;
            var beginDate = "$!startDate";
            var typeF=fareAdapter(fareType);
            jQuery.ajaxPrefilter(function( options, originalOptions, jqXHR ) {
                var key = options.url;
                if (!pendingRequests[key]) {
                    pendingRequests[key] = jqXHR;
                }else{
                    //jqXHR.abort();    //放弃后触发的提交
                    pendingRequests[key].abort();   // 放弃先触发的提交
                }
            });
            jQuery.ajax({
                type:‘post‘,
                url:"common/action.do?action=OneferOperationReportAction&eventSubmitDoLineQuery=true",
                dataType:‘json‘,
                data:{"beginDate": beginDate, "time" : time,"data":data,"fareType":typeF,"currentPage":page},
                cache:false,
                success:function(data){
                    var htmlCount="<span class=‘label label-info‘>"+"</span>条结果";
                    if (data.statu){
                        var datalist = data.results;
                         for(var i=0;i<datalist.length;i++){ 

                         var html="";

  2.                     var d = datalist[i];
                        html="";

  3.                     }
                       

                        OnChanged(data.currentPage,data.totalPage);
                        $("#countDiv").html(htmlCount);
                        $("#detailDiv").html(html);
                    }else {
                        var html="<div style=‘text-align:center;line-height: 60px;‘>"
                                +"<b style=‘color: red;font-size:14px;‘>"
                                +data.erroMessage
                                +"</b></div>";
                        bootS(data.currentPage,data.totalPage);
                        $("#countDiv").html(htmlCount);
                        $("#detailDiv").html(html);
                    }
                },
                error:function(){
                    alert("请稍侯再尝试,请勿重复提交!!!")
                }
            });
        }

     

     


                    $("#countDiv").html(htmlCount);和$("#detailDiv").html(html);绑定的Id参考下图

技术分享

 

简单的 ajax demo

标签:repo   vts   dht   cache   pil   vsp   kvo   word   acl   

原文地址:http://www.cnblogs.com/hqlong/p/6667970.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!