我的 javascript 代码加载器隐藏有问题,但它应该隐藏在 jax 响应的最后一个。
function reverseGeocoding(lat,lng, callback){
var url = 'http://open.mapquestapi.com/nominatim/v1/reverse?format=json&lat=' + lat + '&lon=' +lng+' &zoom=18&addressdetails=1';
$.ajax({
url: url,
crossDomain:true,
success: function(response){
fn1(response,mapobject); //takes 30 seconds
fn2(response,mapobject); //takes 10 seconds
fn3(response,mapobject); //takes 30 seconds
fn4(response,mapobject); //takes 20 seconds
fn5(response,mapobject); //takes 30 seconds
fn6(response,mapobject); //takes 30 seconds
fn7(response,mapobject); //takes 40 seconds
$("#loader").show();
}
});
}
但问题是响应来后加载程序显示。我想在所有函数调用 fn1、fn2、fn3、fn4、fn5、fn6、fn7 之后显示加载器。请帮忙