前端之家收集整理的这篇文章主要介绍了
mui下拉刷新的ajax实现,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
<script>
mui
.
init
({
swipeBack
:
false
,
pullRefresh
{
container
'#pullrefresh'
down
callback
pulldownRefresh
}
});
/**
* 下拉刷新具体业务实现
*/
var
last
=-
5
amount
=
;
function
pulldownRefresh
()
last
=
last
+
table
document
body
querySelector
(
'.mui-table-view'
);
cells
querySelectorAll
'.mui-table-view-cell'
ajax
type
"post"
dataType
"json"
url
"http://localhost/amazeui/data.PHP?action=item"
data
"last="
+
"&amount="
complete
:
function
(){
$
"#load"
).
hide
();},51)"> success
(
msg
){
data
msg
tmp
=
''
$
each
data
i
n
li
createElement
'li'
li
className
'mui-table-view-cell'
innerHTML
'<a class="mui-navigate-right">'
itemname
'</a>'
//下拉刷新,新纪录插到最前面;
table
insertBefore
li
firstChild
mui
pullRefresh
().
endPulldownToRefresh
();
//refresh completed
if
os
plus
)
plusReady
(
setTimeout
pullupLoading
},51)">
1000
else
ready
</script> 原文链接:https://www.f2er.com/ajax/163233.html