0
我有我的代碼一個小問題它似乎停止在JSON文件jQuery和谷歌地圖JSON
和JSON文件10名列表回來,有300多個記錄會有人請告訴我哪裏有出了錯
DEMO http://realcashback.com.au/development/maps.php
var map;
var businessaddress;
var marker;
function initialize() {
var myOptions = {
zoom: 1,
center: new google.maps.LatLng(-37.810013, 144.962683),
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById('map_canvas'),
myOptions);
getlocations();
}
google.maps.event.addDomListener(window, 'load', initialize);
function getlocations(){
$.getJSON('http://realcashback.com.au/development/system/classes/core.php?task=listmyleads', function(data) {
$.each(data, function(i, obj) {
businessname = obj.TradingName;
if(!obj.suburb)
{
businessaddress = obj.street+", "+obj.suburb+" "+obj.state+" "+obj.postcode;
showAddress(businessaddress,businessname);
}
});
});
}
function showAddress(address,name) {
//alert(address);
var geocoder = new google.maps.Geocoder();
geocoder.geocode({'address': address}, function(results, status) {
if(status == google.maps.GeocoderStatus.OK) {
latlngCity = results[0].geometry.location;
// alert(latlngCity);
marker = new google.maps.Marker({
position: latlngCity,
title:name
});
// To add the marker to the map, call setMap();
marker.setMap(map);
}
});
}