- Joined
- Aug 6, 2009
- Messages
- 2,154
- Reaction score
- 442
Code:
function GeolocateStopsTik()
{
if (geoIndex < 50) // limit to array length in puture
{
GeolocateStopsTok(myStops[geoIndex]);
}
}
function GeolocateStopsTok(stop)
{
if (stop.marker == null)
{
geocoder.geocode( { 'address': stop.house + " " + stop.street + " " + stop.city + " " + stop.zip }, function(results, status) {
if (status == google.maps.GeocoderStatus.OK)
{
stop.marker = new google.maps.Marker({
map: map,
position: results[0].geometry.location
});
geoIndex = geoIndex + 1;
GeolocateStopsTik();
}
else if (status == google.maps.GeocoderStatus.OVER_QUERY_LIMIT)
{
setTimeout(GeolocateStopsTik(), 1000);
}
else
{
alert("Geocode was not successful for the following reason: " + status);
//GeolocateStopsTik();
}
});
}
}
Using tiktok principle here instead of loop.
Browser hangs and crashes when "setTimeout(GeolocateStopsTik(), 1000);" gets called.
The code geolocates address. If successful increase index and call Tik. If limit thrown, call tik with a delay, otherwise doesn't matter for now.
No idea what I am missing. Please do help :/:
Edit: never-mind still having a problem
Last edited:

