func_map.php를 통해 현재 지도 값을 받아오는 코드 추가
j_map.php를 통해 지도를 json 형태로 열람하는 코드 추가 연감의 저장코드를 http를 통해 지도를 받아오는 방식에서 func_map.php를 이용하는 방식으로 변경 map.js에서 반환값이 올바른지 확인하는 코드 추가
This commit is contained in:
+29
-8
@@ -37,6 +37,24 @@ function reloadWorldMap(option){
|
||||
//OBJ : startYear, year, month, cityList, nationList, spyList, shownByGeneralList, myCity
|
||||
var $world_map = $('.world_map');
|
||||
|
||||
var deferred;
|
||||
|
||||
function checkReturnObject(obj){
|
||||
if(!obj.result){
|
||||
deferred.reject();
|
||||
return;
|
||||
}
|
||||
|
||||
if(!$.isNumeric(obj.startYear)
|
||||
||!$.isNumeric(obj.year)
|
||||
||!$.isNumeric(obj.month)){
|
||||
deferred.reject();
|
||||
return;
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
function setMapBackground(obj){
|
||||
var startYear = obj.startYear;
|
||||
var year = obj.year;
|
||||
@@ -471,7 +489,7 @@ function reloadWorldMap(option){
|
||||
}
|
||||
|
||||
//deferred mode of jQuery. != promise-then.
|
||||
$.ajax({
|
||||
deferred = $.ajax({
|
||||
url: option.targetJson,
|
||||
type: 'POST',
|
||||
contentType: 'application/json',
|
||||
@@ -483,12 +501,15 @@ function reloadWorldMap(option){
|
||||
aux:option.aux
|
||||
},
|
||||
dataType:'json'
|
||||
})
|
||||
.then(setMapBackground)
|
||||
.then(convertCityObjs)
|
||||
.then(isDetailMap?drawDetailWorldMap:drawBasicWorldMap)
|
||||
.then(setMouseWork)
|
||||
.then(setCityClickable)
|
||||
.then(saveCityInfo);
|
||||
});
|
||||
|
||||
deferred
|
||||
.then(checkReturnObject)
|
||||
.then(setMapBackground)
|
||||
.then(convertCityObjs)
|
||||
.then(isDetailMap?drawDetailWorldMap:drawBasicWorldMap)
|
||||
.then(setMouseWork)
|
||||
.then(setCityClickable)
|
||||
.then(saveCityInfo);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user