如何控制JS按ajax顺序执行?这里是我的代码:JS按ajax顺序执行
function forexample() {
$(".bewait").css("display", "block");
ajaxrequest(); // here is a ajax request method.
// I also added "async: false" in the method.
$(".bewait").css("display", "none");
}
当我运行forexample()
,它工作正常在Firefox,但我发现铬都没有,似乎铬首先运行AJAX方法,然后运行CSS控制JS在一起。
我该如何解决它在Chrome中正确运行?