我正与一个移动应用程序,其中 第一页有jQuery Mobile的页面波动
HTML工作
<ul>
<li>121212</li>
<li>123233</li>
<li>232323</li>
<li>4323423</li>
<ul>
当 “礼” 的用户点击,那么他/她进入了下一页,该页面将通过Ajax
检索与选定“li”相关的数据。 这几乎是好的..
但是当Ajax
响应来页面波动2倍。 意味着一次页面加载,下次页面全白,然后再次显示Ajax
响应页面。 为什么?
Ĵ查询
$("clickOnLi").click(function(){
var id= $(this).val(); //get the selected li value
$('.loadingGif').css({ 'display':'block' });
$("#ulShowContent").html(''); // to remove old inner HTML to show new result html
var dataString = 'selectedid='+id;
$.ajax({
type: "POST",
url: remoteUrl+"handler.php",
data : dataString,
cache: true,
success: function(response) {
if(response){
$('.loadingGif').css({ 'display':'none' });
$("#ulShowContent").html(response);
}
}
});
})
**and the result will show in this html**
<ul id="ulShowContent" data-role="listview">
<li class="comment chatsend">
<div class="comment-meta">
data 1
</div>
</li>
<li class="comment chatsend">
<div class="comment-meta">
data 2
</div>
</li>
</ul>
很少的问题。在换页之前或之后,你会做一个ajax调用吗? – Gajotres 2013-02-22 08:55:05