我有这个JS函数,它将调用下一个图像:
function showNextManifest() {
var currentManifest = jQuery('#selectedManifestId').val();
jQuery.ajax({
url: "${createLink(action:'nextManifest')}?currentManifestId=" + currentManifest,
dataType: "json",
success: function(e) {
if (e.success) {
jQuery('#gotoPageNumber').val(e.pageNumber);
jQuery('#selectedManifestId').val(e.id);
jQuery('#popupManifestCustomItemId').val(e.id);
showLargeManifestViewer(e.url);
} else {
alert('No more additional frames for this roll.');
}
}
});
}
我想放入一个gif预加载,直到图像显示出来。这是否在if(e.success)之前?
答案 0 :(得分:0)
在ajaxing之前,只需将加载程序gif
添加到容器中;我可以看到你的功能取代了网址。
function showNextManifest() {
showLargeManifestViewer('/loading.gif');
//now it shows loader gif until ajax completed
var currentManifest = jQuery('#selectedManifestId').val();
jQuery.ajax({
url: "${createLink(action:'nextManifest')}?currentManifestId=" + currentManifest,
dataType: "json",
success: function(e) {
if (e.success) {
jQuery('#gotoPageNumber').val(e.pageNumber);
jQuery('#selectedManifestId').val(e.id);
jQuery('#popupManifestCustomItemId').val(e.id);
showLargeManifestViewer(e.url);
} else {
alert('No more additional frames for this roll.');
}
}
});
}