var p = 0;
var createFragment = function(ul, index, count, reverse) {
var fragment = document.createDocumentFragment();
var li;
mui.ajax({
url:"http://api.1-blog.com/biz/bizserver/xiaohua/list.do",
data:{
size:10,
page:p
},
dataType:'json',
type:'post',
timeout:10000,
success:function(dat){
alert(dat);
var data = dat['detail'];
for (var i=0;i<data.length;i++) {
li = document.createElement('li');
li.className = 'mui-table-view-cell mui-media';
li.innerHTML = "<div class='mui-media-body'>作者:"+data[i].author+"<br><p class='jokecontent'>"+data[i].content+"</p></div>";
fragment.appendChild(li);
}
},
error:function(){
}
})
p++;
return fragment;
};
Meiko (作者)
嗯,跨域jsonp可以解决,没有注意是异步的原因,代码执行顺序的问题。
2016-04-25 17:17