AJAX .post异步 [英] AJAX .post async

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

问题描述

以下内容到底是做什么的?

What exactly does the following do:

$.ajax({
     type: "POST",
     async: false,

vs

$.ajax({
    type: "POST",
    async: true,

意思是行为上的区别是什么?

Meaning what is the difference in the behavior?

推荐答案

来自 jQuery网站:

默认情况下,所有请求都是异步发送的(即默认情况下设置为true).如果需要同步请求,请将此选项设置为false.跨域请求和dataType:"jsonp"请求不支持同步操作.请注意,同步请求可能会暂时锁定浏览器,从而在请求处于活动状态时禁用任何操作.

By default, all requests are sent asynchronously (i.e. this is set to true by default). If you need synchronous requests, set this option to false. Cross-domain requests and dataType: "jsonp" requests do not support synchronous operation. Note that synchronous requests may temporarily lock the browser, disabling any actions while the request is active.

仅此而已.如果您需要特定问题的帮助,请告诉我.

That's all there is to it. If you need help on a specific problem let me know.

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

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