Добрый вечер!
Имеется функция:
function geoByIp(){
showSpinner();
request('fw/geo/byip',{},function(obj){
location.geoByIpAlert = true;
if(localStorage.getItem('registered') === 'true'){
//alert(mapLoadedTest);
showGeoByIpAlert();
}
location.init = false;
Freewash.debugInfo.geoByIp = {};
if(obj.status>0){
location.lat = obj.geo.city.lat;//obj.geo.city.lat
location.lng = obj.geo.city.lon;//obj.geo.city.lon
location.acc = 0.7;
location.geo = obj.geo;
location.geo.country = obj.country;
Freewash.debugInfo.geoPosLat = location.lat;
Freewash.debugInfo.geoPosLong = location.lng;
Freewash.debugInfo.geoPosAcc = location.acc;
if (typeof _userPos !== 'undefined') {
_userPos.setPosition({lat: location.lat, lng: location.lng});
}
if(mapLoadedTest == true){
renderContent('search');
}
Freewash.debugInfo.geoByIp = 1;
delete Freewash.debugInfo.geoErrorCode;
delete Freewash.debugInfo.geoErrorMsg;
alert('тесм');
//loadMapScript();
loadAds();
location.byip = true;
} else {
Freewash.debugInfo.geoByIp = 0;
console.log('Freewash.debugInfo.geoByIp = '+Freewash.debugInfo.geoByIp);
win.setTimeout(function(){
console.log('timeout:'+Freewash.debugInfo.geoByIp);
geoByIp();
},5000);
}
},function(){
Freewash.debugInfo.geoByIp = -1;
console.log('Freewash.debugInfo.geoByIp = '+Freewash.debugInfo.geoByIp);
win.setTimeout(function(){
console.log('timeout:'+Freewash.debugInfo.geoByIp);
geoByIp();
},5000);
});
}
Код не выполняется в части :
if(obj.status>0){
location.lat = obj.geo.city.lat;//obj.geo.city.lat
location.lng = obj.geo.city.lon;//obj.geo.city.lon
location.acc = 0.7;
location.geo = obj.geo;
location.geo.country = obj.country;
Freewash.debugInfo.geoPosLat = location.lat;
Freewash.debugInfo.geoPosLong = location.lng;
Freewash.debugInfo.geoPosAcc = location.acc;
if (typeof _userPos !== 'undefined') {
_userPos.setPosition({lat: location.lat, lng: location.lng});
}
if(mapLoadedTest == true){
renderContent('search');
}
Freewash.debugInfo.geoByIp = 1;
delete Freewash.debugInfo.geoErrorCode;
delete Freewash.debugInfo.geoErrorMsg;
alert('тесм');
//loadMapScript();
loadAds();
location.byip = true;
}
Если же alert переместить в верх условия, то он отображается. В любом другом случае нет. В чем может быть дело?