使用dojo XHR请求加载指示符 [英] Loading indicator with dojo XHR requests
问题描述
dojo.xhrGet({
url:registcarturl,
handleAs:json
preventCache:true,
load:function(data,ioArgs){
// DO STUFF WITH data HERE
},
error:function(error) {
alert(抱歉!使用ajax添加到购物车时发生错误);
}
});
我如何将gif文件加载到互动中?谢谢。
看看 dojox.widget.Standby
: http://dojotoolkit.org/reference-guide/dojox/widget/Standby。 html
给你一个例子,定义 widget.Standby
< div jsId =basicStandby1dojoType =dojox.widget.Standbytarget =yourDomTarget>
调用 dojo.xhrGet
后,显示:
basicStandby1.show();
收到您的答案时,请隐藏:
basicStandby1.hide();
I only recently started using dojo and I am doing numerous ajax calls using dojo xhrGet, xhrPost,..etc. Now I have an animated gif image which i want to use to indicate "loading" to the user. I am not too sure how this can be done. Can someone please advise me on this? here is my code,
dojo.xhrGet({
url: registcarturl,
handleAs: "json",
preventCache: true,
load: function(data, ioArgs) {
//DO STUFF WITH data HERE
},
error: function(error) {
alert("sorry ! an error occurred while adding to the cart with ajax");
}
});
How do i get my loading gif file into the interaction? Thank you.
Have a look at dojox.widget.Standby
: http://dojotoolkit.org/reference-guide/dojox/widget/Standby.html
To give you an example, define the widget.Standby
<div jsId="basicStandby1" dojoType="dojox.widget.Standby" target="yourDomTarget">
After calling dojo.xhrGet
, show it:
basicStandby1.show();
And when you receive your answer, hide it:
basicStandby1.hide();
这篇关于使用dojo XHR请求加载指示符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!