AJAX同步和异步的区别 [英] AJAX sync and async difference

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

问题描述

什么是同步和异步AJAX calls.When使用同步时之间的区别异步?

What's the difference between sync and async AJAX calls.When to use sync and when async?

推荐答案

在一个非常基本的水平,您使用的异步模式,当你想呼叫的时候,你希望你的code发生在后台同步模式等到调用完成。

At a very basic level, you use an asynchronous mode when you want the call to occur in the background and a synchronous mode when you want your code to wait until the call has completed.

异步模式适合于Ajax的通常的方法调用,如你一般附加一个回调函数的的onreadystatechange 事件,使得你可以在服务器端的数据是应对准备好了,而不是等待数据的到来。

The asynchronous mode is the usual approach for AJAX calls, as you generally attach a callback function to the onreadystatechange event so that you can respond when the server-side data is ready, rather than waiting for the data to arrive.

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

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