简体   繁体   English

在成功处理程序之外获取jquery ajax响应

[英]get jquery ajax response outside of success handler

I know I can do this by setting async: false , but doing so will defeat the purpose of Ajax (this will no longer be Ajax anymore as this will lock my browser until the request is complete). 我知道我可以通过设置async: false来做到这一点,但是这样做会破坏Ajax的目的(它将不再是Ajax,因为这将锁定我的浏览器,直到请求完成为止)。 Is it possible AT ALL to get the response from an Ajax request outside of the success handler without setting async: false ? 是否有可能在没有设置async: false情况下从success处理程序之外的Ajax请求获取响应?

Please let me know if this is possible 请让我知道是否可能

Thank you 谢谢

You need to have a callback because of the way asynchronous calls work. 由于异步调用的工作方式,您需要有一个回调。 I don't think there's a way of directly getting the data without blocking. 我认为没有一种可以直接获取数据而不会阻塞的方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM