jQuery ajax async: false causes a strange warning?

前端 未结 5 1110
一生所求
一生所求 2020-12-04 02:10

In my JS App, i have many Ajax calls with async: false. I am using latest Chrome browser and in my console below warning appears recently.

<
5条回答
  •  南方客
    南方客 (楼主)
    2020-12-04 02:35

    Is the warning just a bug or something?

    The warning itself isn't a bug. It's warning you that there may be bugs in your code. The functionality your code uses is deprecated, which means there is an increasingly small guarantee that it will work as you expect it to. The warning is simply, well, warning you about this.

    Can i worry about that or ignore that?

    Ignoring warnings is generally a bad idea. When they eventually become errors you'll have only yourself to blame for the downtime.

    But it causes a lot of error because my app needs to run with async: false

    You're mixing up the cause/effect relationship here. async: true isn't causing errors, the code is. Those errors should be corrected, not circumvented. Circumventing the errors by using async: false simply defers fixing them until later. This warning is telling you that "later" is approaching, and recommending that you fix the problems before they become worse.

    If your app "needs to run with async: false" then your app is incorrectly designed. The warning is suggesting that you fix it. So is everybody else here.

提交回复
热议问题