Ajax async false is deprecated?

前端 未结 2 1810
忘了有多久
忘了有多久 2020-12-21 07:05

I am using jQuery 1.7 and I use async:false for my AJAX requets, but I\'ve learned that this function is deprecated.

I need to use callback but this doe

2条回答
  •  轮回少年
    2020-12-21 07:31

    From the documentation:

    As of jQuery 1.8, the use of async: false with jqXHR ($.Deferred) is deprecated

    You are not using it with jqXHR.

    That said, non-async HTTP is horrible with JavaScript and best avoided. Do your work in or from the callback. Don't try to return data to the calling function so it can do the work.

提交回复
热议问题