AJAX请求同步VS异步 [英] AJAX requests Synchronous Vs Asynchronous

查看:112
本文介绍了AJAX请求同步VS异步的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一个同步的请求,并与异步请求的性能之间有什么区别(速度明智)?

Is there any difference in performance ( speed wise ) between a synchronous request and and asynchronous request?

什么都是理由使用异步请求??

What all are the reasons for using an asynchronous request??

推荐答案

您应该多为始终使用异步AJAX请求,其实我知道,只有一个地方,一个同步的Ajax请求应使用的是如果你在一个Ajax请求嵌入在客户端上一个新的JavaScript文件,然后从JavaScript的从原来的Ajax请求返回引用的文件类型和/或对象。那么这个新的JS文件的抓取应该(或可以三立)通过使用同步的Ajax请求包括...

You should mostly always use an asynchronous Ajax Request, in fact I know only about one place where a synchronous Ajax Request should be used which is if you're in an Ajax Request embedding a new JavaScript file on the client and then referencing types and/or objects from that JavaScript file in the return from the original Ajax Request. Then the fetching of this new JS file should (or can sanely) be included through using a synchronous Ajax Request...

其他然后,你应该的总是的使用异步Ajax请求。最重要的原因是同步的Ajax请求,使用户界面(浏览器)无响应...

Other then that you should always use asynchronous Ajax Requests. The most important reason is that a synchronous Ajax Request makes the UI (browser) unresponsive...

这篇关于AJAX请求同步VS异步的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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