如何用ajax实现mui下拉列表
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了如何用ajax实现mui下拉列表相关的知识,希望对你有一定的参考价值。
参考技术A <script>mui.init(
swipeBack:
false,
pullRefresh:
container:
'#pullrefresh',
down:
callback:
pulldownRefresh
);
/**
* 下拉刷新具体业务实现 */
var
last=-5,amount=5;
function
pulldownRefresh()
last =last+amount;
var
table =
document.body.querySelector('.mui-table-view');
var
cells =
document.body.querySelectorAll('.mui-table-view-cell');
mui.ajax(
type:
"post",
dataType:
"json",
url:
"http://localhost/amazeui/data.php?action=item",
data:
"last="+last+"&amount="+amount,
complete :function()$("#load").hide();,
success:
function(msg)
var
data =
msg;
var
tmp='';
$.each(data,
function(i,
n)
var
li =
document.createElement('li');
li.className
=
'mui-table-view-cell';
li.innerhtml
=
'<a class="mui-navigate-right">'
+
n.itemname
+
'</a>';
//下拉刷新,新纪录插到最前面;
table.insertBefore(li,
table.firstChild);
);
);
mui('#pullrefresh').pullRefresh().endPulldownToRefresh();
//refresh completed
if
(mui.os.plus)
mui.plusReady(function()
setTimeout(function()
mui('#pullrefresh').pullRefresh().pullupLoading();
,
1000);
);
else
mui.ready(function()
mui('#pullrefresh').pullRefresh().pullupLoading();
);
</script>
如何用php+ajax实现页面的局部刷新?(转)
client.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> < html > < head > < meta http-equiv = "content-type" content = "text/html; charset=utf-8" > < title > jquery demo </ title > < script src = "//code.jquery.com/jquery-1.11.0.min.js" ></ script > < script type = "text/javascript" > function show(){ $.get( "server.php", function(data) { $(‘#txt‘).html(data.content); }, "json" ); } </ script > </ head > < body > < p >這裡不會被刷新</ p > < div id = "txt" >原來內容</ div > < input type = "button" value = "刷新內容" onclick = "show()" > </ body > </ html > |
server.php
1
2
3
4
5
6
7
|
<?php $ret = array (); $ret [ ‘content‘ ] = ‘新內容‘ ; echo json_encode( $ret ); ?> |
以上是关于如何用ajax实现mui下拉列表的主要内容,如果未能解决你的问题,请参考以下文章
mfc如何用txt保存下拉框控件的内容?下拉框如何读入TXT中的内容到属性-数据中?
如何用VB6中的COMBOBOX实现模糊输入后自动匹配下拉列表
angularjs`angucomplete-alt` - 如何用一些数字限制下拉列表?
jsp里面如何用forEach取一个数组里面的值,从而实现一个下拉列表