最初のページにあるモバイルアプリケーションを使用しています
HTML
<ul>
<li>121212</li>
<li>123233</li>
<li>232323</li>
<li>4323423</li>
<ul>
ユーザーが「li」をクリックすると、次のページに入力され、選択した「li」に関連するデータが 経由で取得されますAjax
。これはほぼ順調です..
しかし、Ajax
応答が来ると、ページは2回変動します。一度ページが読み込まれ、次回はページが完全に白くなり、再びAjax
応答のあるページが表示されることを意味します。どうして ???
Jクエリ
$("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>