How can I control the JS executes in order with ajax? Here is my code:
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");
}
when I run the forexample()
, it works correctly in Firefox, but I found the chrome did not, it seems chrome runs the ajax method firstly, then runs the css control js together.
How can I fix it to run correctly in chrome?