首页 > 代码库 > 简单的 ajax demo

简单的 ajax demo

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