【发布时间】:2013-05-03 10:05:48
【问题描述】:
我是 Jquery mobile 的新手,在我的 Index.html 页面中,当我单击搜索按钮时,列表将使用 ajax 调用动态生成,当我单击列表时,它将转到显示页面并显示所有值。问题是当我从显示页面返回搜索并再次单击列表时,ajax 调用发生了两次(意味着页面正在重新加载两次)。 我正在使用 $(document).on('pageinit', function() {});
请细化下面的代码:
index.html
<input type="button" id='sear' value="Search">
<div id="output" data-dom-cache="true">
<ul data-role="listview" data-inset="true" id="display">
</ul>
</div>
搜索.js
$.post("mobileser", {data},function(res) {
$('#output ul').append("<li> <a href=./mobile/pages/details.html data-ajax='false'>"+'Incident No: '+v+' </li>'+'</a>');
$('#display').listview('refresh');
details.html
<input type="text" id="Module" name="Module" placeholder="AutoComplete" data-mini="true" >
<input type='hidden' value='' name="hmoduleId" id="hmoduleId" class="autoCompleteCheck" />
viewdetails.js
$(document).on(pageinit, function() {
$.post("url", {data}, function(res) {
$(Module).val(value);
},)
})
请帮帮我...
【问题讨论】:
-
你能发布你的代码吗?
-
这是一个已知问题(它不是错误)。向我们展示您的代码,以便我们向您展示如何修复它。也可以看看我的另一篇文章:stackoverflow.com/a/14469041/1848600,搜索一章:防止多事件绑定/触发
-
嗨,你明白了还是要发布所有代码
-
你能更新一下吗
标签: jquery-ui jquery jquery-mobile jquery-plugins