首页 新闻 会员 周边 捐助

swiper怎么动态加载数据?

0
悬赏园豆:5 [待解决问题]

$.ajax({ url: "../Minitor/data_SOE.ashx?Action=GetSOEByPage", type: "GET", dataType: "json", data: { page: page, treeid: 1, rows: 10, endtime: endtime, starttime: '2016-07-20 00:00:00' }, cache: false, success: function (data) { var data = eval(data); var num = data.ResultData.DataTable.length; var total = data.ResultData.totalRecords; var max = Math.floor(10 / 10); var mySwiper = new Swiper('.swiper-container', { onSlideNextStart: function (swiper) { $.ajax({ url: "../Minitor/data_SOE.ashx?Action=GetSOEByPage", type: "GET", dataType: "json", data: { page: 1, treeid: 1, rows: 10, endtime: endtime, starttime: '2016-07-20 00:00:00' }, cache: false, success: function (data) { var data = eval(data); var mySwiper = new Swiper('.swiper-container', { }); var html = ""; for (var i = 0; i < 10; i++) { html += data.ResultData.DataTable[i].TagName; if ((i + 1) % 10 == 0) { mySwiper.appendSlide('

' + 'html' + '

'); //加到Swiper的最后 $(".swiper-slide").addClass('container jin1'); mySwiper.update(); } }; // $(".swiper-container").find('.swiper-wrapper').html(s); }, error: function (data) { alert("未查明原因"); } }); } }); var html = ""; for (var j = 0; j < 10; j++) { var time = new Date(eval('new ' + (data.ResultData.DataTable[j].CreateTime.replace(/\//g, '')))).Format('yyyy-MM-dd hh:mm:ss'); html += "

" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + '' + "" + "" + "

" + "" + data.ResultData.DataTable[j].IEDNO + "" + " " + "" + "" + "" + "" + "" + "
" + "安装位置:" + " " + data.ResultData.DataTable[j].StationName + data.ResultData.DataTable[j].MainLineName + data.ResultData.DataTable[j].TwoerAdr + "
" + data.ResultData.DataTable[j].TagName + " ' + time + '

"; $(".table tbody tr td").find("i").addClass("icon iconfont"); $(".table tbody tr td a i").css({ "color": "#337ab7" }); $(".icon ").css({ "text-align": "right" }); if ((j + 1) % 10 == 0) { mySwiper.appendSlide('

' + html + '

'); //加到Swiper的最后 $(".swiper-slide").addClass('container jin1'); html = ""; } }; // $(".swiper-container").find('.swiper-wrapper').html(); }, error: function (data) { alert("未查明原因"); } });

问题补充:

就是谁有swiper做的动态加载数据的例子?就是先加载10条数据,然后往后滑动一下,就再加载10条数据

年少的青年的主页 年少的青年 | 初学一级 | 园豆:199
提问于:2017-01-07 13:35
< >
分享
所有回答(1)
0

楼主解决了么

isyang0410 | 园豆:202 (菜鸟二级) | 2017-06-23 14:37
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册