我在使web服务调用正常工作时遇到问题。清除Ajax结果
我的成功电话将LI标签列表添加到UL,目标是在进行另一个电话之前清除这些结果。现在,如果您要点击通话按钮,新的结果将被添加到列表中。
我使用.listview('refresh');应该这样做,但它不适合我。
关于发生了什么的任何想法?
的HTML
的JS
getAlbumImages = function (album) {
$.ajax({
url: wcfServiceUrl + "GetMediaSource?AlbumId=" + album,
data: '{}',
type: 'GET',
contentType: "application/x-www-form-urlencoded",
async: true,
//crossBrowser: true,
dataType: 'jsonp',
//jsonpCallback: 'MediaSource',
timeout: 5000,
success: function (data, status) {
$.each(data, populateImageGrid);
},
complete: function() {
$("ul#Gallery").listview("refresh");
},
error: function() {
alert('There was an error loading the data.');
}
});
}
function populateImageGrid() {
var photoSource, thumbSource, title, description;
photoSource = this.ImageSource;
thumbSource = this.ThumbSource;
title = this.Title;
description = this.Description;
imageTile += "
console.log(imageTile);
$("ul#Gallery").html(imageTile);
//$("ul#Gallery").listview();
// $("ul#Gallery").listview('refresh');
}
感谢