Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ajax] 2.同步和异步的区别? #63

Open
qiilee opened this issue Sep 29, 2019 · 0 comments
Open

[ajax] 2.同步和异步的区别? #63

qiilee opened this issue Sep 29, 2019 · 0 comments
Labels

Comments

@qiilee
Copy link
Member

qiilee commented Sep 29, 2019

答案:同步:阻塞的;异步:非阻塞的。

解析:

同步:阻塞的

  • 张三叫李四去吃饭,李四一直忙得不停,张三一直等着,直到李四忙完两个人一块去吃饭

  • 浏览器向服务器请求数据,服务器比较忙,浏览器一直等着(页面白屏),直到服务器返回数据,浏览器才能显示页面

异步:非阻塞的

  • 张三叫李四去吃饭,李四在忙,张三说了一声然后自己就去吃饭了,李四忙完后自己去吃

  • 浏览器向服务器请求数据,服务器比较忙,浏览器可以自如的干原来的事情(显示页面),服务器返回数据的时候通知浏览器一声,浏览器把返回的数据再渲染到页面,局部更新

@qiilee qiilee added the Ajax label Sep 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant