加载操作无法正常工作&加载页面时,由于加载操作,页面被挂起了几秒钟。
代码如下。
$("#loadingIcon").show();
$.ajax({
type: "GET",
url: "displayCartItems.action",
data: param,
success: function(result){
$('#cartPage').html(result) ;
$("#loadingIcon").hide();
getCartItemPriceDetail();
loadCart = false;
},
});
$(“#loadingIcon”)。show()由gif图片组成,但在加载时挂在网页上
请找到图片并为此提供解决方案
尝试在ajax中显示图像beforeSend
。还要检查ajaxsuccess
功能是否正在运行或该error
功能。
$.ajax({
type: "GET",
url: "displayCartItems.action",
data: param,
beforeSend: function() {
$("#loadingIcon").show();
},
success: function(result) {
$('#cartPage').html(result);
$("#loadingIcon").hide();
getCartItemPriceDetail();
loadCart = false;
},
error: function(jqXHR, textStatus, errorThrown ) {
console.log(textStatus);
}
});
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句