0
我想asynchonios加載地圖,我已經呈現的映像:Gmaps4Rails附加標記,以現有的地圖
handler = Gmaps.build('Google');
handler.buildMap({ provider: {
mapTypeId: google.maps.MapTypeId.ROADMAP,
styles: mapStyle_dark },
internal: {
id: 'map'}}, function() {
var json_array = $.getJSON("locations/async.json", function (data) {
return data;
});
var markers = handler.addMarkers(json_array);
handler.fitMapToBounds();
handler.getMap().setZoom(2);
});
我的Ajax響應看起來是這樣的:
[{"lat":48.21042800000001,"lng":16.3822238,"infowindow":{"id":"53a0a0012d289ec127000020","image":"veq3r13nbgn5qg9c7zqk","name":"Blended Shisha Lounge Bar","categories":[{"name":"Bars","slug":"bars","icon":"bars"}],"coordinates":[16.3822238,48.21042800000001]},"picture":{"anchor":[17,17],"url":"/assets/map/icons/categories/bars-38.png","width":38,"height":38}}]
但指標得到不追加。
我做錯了什麼?
冷靜,謝謝! :-) – Jan 2014-09-08 07:22:11