且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何停止javascript等待延迟完成?

更新时间:2022-06-17 03:55:06

在等待一些异步ajax调用完成时,您无法停止javascript的执行. Javascript根本无法正常工作.

You cannot stop the execution of javascript while waiting for some asynchronous ajax call to finish. Javascript simply doesn't work that way.

相反,您必须重新编写程序,以便要等待异步ajax调用完成的代码将通过回调函数执行,而不是在ajax调用执行后同步执行.

Instead, you have to rework the way you program so that code that wants to wait for an asychronous ajax call to be completed will execute via a callback function, not synchronously after the ajax call executes.