如何使用blockUI功能处理ajax调用。 [英] How to handle ajax call with blockUI feature.

查看:71
本文介绍了如何使用blockUI功能处理ajax调用。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨朋友们!



我在java-script ajax请求期间在项目中的某个地方被阻止实现了Loading Spinner。



我正在使用java-script ajax调用从数据库加载一些数据,需要加载微调器白色请求正在进行中。由于数据是批量的,因此ajax请求需要一些时间,因此程序控制跳过请求并处理下一个代码语句。在下一个代码块中,我使用ajax调用的响应作为数据对象。因此数据尚不可用,并且会引发错误。但同时加载微调器的工作原理。



我试图在ajax调用中设置async:false但是这次我加载微调器不能用作程序控制器首先处理ajax请求而不是其他请求。



我试图在ajax调用之前调用加载微调器调用,但它无效。



有什么方法可以实现这两种功能。



非常感谢您的帮助。





〜问候!



Chandrakant

Hi Friends !

I am blocked somewhere in project with implementing Loading Spinner during java-script ajax request.

I am loading some data from database using java-script ajax call and need to put loading spinner white request is in progress. The ajax request takes a bit time as data is bulk hence program control skip the request and process for next code statement. And in next code block i am using response of ajax call as data object. So data is unavailable yet and it throws an error. But for the same time loading spinner works.

I tried to set async : false, in ajax call but this time me loading spinner does not works as program controller first process ajax request and than other request.

I have tried to put that loading spinner call before ajax call but it is not working.

Is there any way where i can achieve both of functionality.

Thank you very much in advance for your help.


~Regards !

Chandrakant

推荐答案

这只需使用ajaxStart()和ajaxStop()即可实现方法。


This is achieved simply by using ajaxStart() and ajaxStop() methods.


(document).ajaxStart(function(){
( document ).ajaxStart(function() {


(#loading)。show();

});


( "#loading" ).show();
});


这篇关于如何使用blockUI功能处理ajax调用。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆