jQuery的阿贾克斯导入图像 [英] Jquery Ajax Loading image
本文介绍了jQuery的阿贾克斯导入图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想实现一个装载图像为我的jQuery的ajax code(这是当了jQuery仍在处理)下面是我的code:
I would like to implement a loading image for my jquery ajax code (this is when the jquery is still processing) below is my code:
$.ajax({
type: "GET",
url: surl,
dataType: "jsonp",
cache : false,
jsonp : "onJSONPLoad",
jsonpCallback: "newarticlescallback",
crossDomain: "true",
success: function(response) {
alert("Success");
},
error: function (xhr, status) {
alert('Unknown error ' + status);
}
});
我怎样才能实现这个code加载图像。 谢谢
How can I implement a loading image in this code. Thanks
推荐答案
尝试是这样的:
<div id="LoadingImage" style="display: none">
<img src="" />
</div>
<script>
function ajaxCall()
{
$("#LoadingImage").show();
$.ajax({
type: "GET",
url: surl,
dataType: "jsonp",
cache : false,
jsonp : "onJSONPLoad",
jsonpCallback: "newarticlescallback",
crossDomain: "true",
success: function(response) {
$("#LoadingImage").hide();
alert("Success");
},
error: function (xhr, status) {
$("#LoadingImage").hide();
alert('Unknown error ' + status);
}
});
}
</script>
这篇关于jQuery的阿贾克斯导入图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文