更新时间:2022-06-24 22:37:10
因为默认情况下jquery ajax请求是异步的.您可以使用async: false
选项或(***)使用回调函数来使请求同步.
另外,如 CharlesLeaf 所述,使用同步请求将锁定浏览器,直到收到响应为止.
Because jquery ajax requests are asynchronous by default. You can make request synchronous by using async: false
option or (better) use callback function.
Also, as CharlesLeaf notes, using synchronous request will lock up the browser until response is received.
关于异步操作的整个概念.
我会从jquery站点链接一些解释,但现在似乎已经结束.
About the whole concept of asynchronous operations.
I would link some explanation from jquery site, but it seems to be down now.