回答編集履歴
1
追記
test
CHANGED
@@ -1 +1,91 @@
|
|
1
1
|
`Yucho.gMapInit()`の直後に地図範囲を取得しようとしてますから、地図の読み込みが終わっていないのではないでしょうか。idleイベントを待ってからJSONを取得するといいと思います。
|
2
|
+
|
3
|
+
|
4
|
+
|
5
|
+
|
6
|
+
|
7
|
+
##### コメントを受けて追記
|
8
|
+
|
9
|
+
```javascript
|
10
|
+
|
11
|
+
///////////////////////////////////////////////////////////////////////
|
12
|
+
|
13
|
+
// MAPリフレッシュ
|
14
|
+
|
15
|
+
//アイドルされた時、Jsonを再読み込み
|
16
|
+
|
17
|
+
///////////////////////////////////////////////////////////////////////
|
18
|
+
|
19
|
+
Yucho.refleshMap = function() {
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
// マップサイズ取得
|
24
|
+
|
25
|
+
Yucho.getMapSize();
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
// json読み込み
|
30
|
+
|
31
|
+
Yucho.getJson();
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
};
|
38
|
+
|
39
|
+
```
|
40
|
+
|
41
|
+
```javascript
|
42
|
+
|
43
|
+
///////////////////////////////////////////////////////////////////////
|
44
|
+
|
45
|
+
// JSON読み込み
|
46
|
+
|
47
|
+
///////////////////////////////////////////////////////////////////////
|
48
|
+
|
49
|
+
Yucho.getJson = function(){
|
50
|
+
|
51
|
+
$.ajax({
|
52
|
+
|
53
|
+
type: "GET",
|
54
|
+
|
55
|
+
url: '/ajaxtestmaps/testsearch.json' + '?min_lat=' + Yucho.swLat + '&max_lat=' + Yucho.neLat + '&min_lng=' + Yucho.swLng + '&max_lng=' + Yucho.neLng,
|
56
|
+
|
57
|
+
dataType: "json",
|
58
|
+
|
59
|
+
}).done(function(jsonDataList){
|
60
|
+
|
61
|
+
Yucho.jsonData = jsonDataList;
|
62
|
+
|
63
|
+
$('#status_all').html(Yucho.jsonData.jsonDataList.length);
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
// マーカー削除
|
68
|
+
|
69
|
+
Yucho.markerArr.forEach(function(marker, idx) {
|
70
|
+
|
71
|
+
marker.setMap(null);
|
72
|
+
|
73
|
+
});
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
// マーカー作成
|
78
|
+
|
79
|
+
Yucho.createMarker();
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
//console.log('/ajaxtestmaps/testsearch.json' + '?min_lat=' + Yucho.swLat + '&max_lat=' + Yucho.neLat + '&min_lng=' + Yucho.swLng + '&max_lng=' + Yucho.neLng);
|
84
|
+
|
85
|
+
});
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
};
|
90
|
+
|
91
|
+
```
|