HTTP同步请求会阻止我的GIF在Chrome和IE中移动? [英] HTTP synchronous request stops my GIF moving in Chrome and IE?

查看:118
本文介绍了HTTP同步请求会阻止我的GIF在Chrome和IE中移动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Firefox中,我发生了一个同步请求(必须同步,否则以后的JS将无法正确运行),现在在XMLHttpReq函数中,它基本上将DIV的内容之一更改为微小的加载徽标(变成齿轮),因此您可以看到进度...在FF中,它可以100%异步或同步... Chrome和IE没有这种运气..?

In Firefox, I have a synchronous request that happens (it must be sync or the later JS will not run correctly) now in the XMLHttpReq function it basically changes one of the DIV's contents to a tiny loading logo (turning cog) so you can see progress... In FF this works 100% async or sync... Chrome and IE no such luck..?

任何人都可以帮助我或解释为什么吗?我想这与禁用所有其他进程有关,但是如果是这样的话,在原始XMLHttpReq加载后,如何使它正常工作或评估并生成JS文件?

Can anyone help me or explain why please? Im guessing it something to do with them disabling ALL other processes but if this is so how can i get this to work OR evaluate and JS file after this original XMLHttpReq has loaded?

推荐答案

同步调用会阻塞您的浏览器,直到交易完成为止,这是建议不要这样做的原因.

Synchronous calls tie up your browser until the transaction is finished, which is why it is advised against.

您应该查看对异步调用进行排序的过程.含义...问题不在于您的异步调用,而是您使用it must be sync or the later JS will not run correctly的原因.在AJAX回调中设置completed变量非常简单,其他有问题的JS可以在执行之前检查该变量.

You should look at sequencing your asynchronous calls. Meaning... the problem isn't with your asynchronous call, it's in your reason why it must be sync or the later JS will not run correctly. Setting a completed variable in the AJAX callback is pretty simple to do, which the other problematic JS can check before executing.

这篇关于HTTP同步请求会阻止我的GIF在Chrome和IE中移动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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