Reputation: 1345
In all major browsers my markers on my map work, but not in chrome. Sometimes they work, mostly they don't for no reason. The error i get is: Uncaught TypeError: Type error as in this link. http://d.pr/i/Ojxc
The links I get to the Main.js is the minified google api js file. When i zoom out on my map i get the error over and over again. Zooming stops for no reason then, and then the map blocks.
In html everything is correct, the ajaxcall returns the correct data and it works in Safari, Opera, Firefox.
I am desperate here.
My js code:
function addStores(){
if(typeof google === 'object' && typeof google.maps === 'object'){
try{
$.ajax({
type:"GET",
url: api_url + '/locations',
success: function(data){
var stores = $.parseJSON(data);
for(var i=0; i<stores.length; i++){
console.log("hallo");
var indi = i;
var image = new google.maps.MarkerImage('images/store/[email protected]', null, null, null, new google.maps.Size(32,50));
var myLatLng = new google.maps.LatLng(stores[i].latitude, stores[i].longitude);
var marker = new google.maps.Marker({
position: myLatLng,
map:map,
icon: image,
tel: stores[i].tel,
state: stores[i].state,
street: stores[i].street
});
google.maps.event.addListener(marker, 'click', function(){
console.log("hkom");
map.setCenter(new google.maps.LatLng(marker.position.lat(), marker.position.lng()));
map.setZoom(15);
console.log("hallo");
opPinGeklikt(event, this);
});
}
},error:function(){
console.log(arguments);
}
});
}catch(e){
console.log(e);
}
}
}
Thx in advance. W.
Upvotes: 1
Views: 747