w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
setTimeout not working. Console says latLng is not defined

That is because latLng is not available in the closure. Could you try adding var before the latLng declaration:

success : function(data) {
    var latLng = data.split(" ");

    for ( i = 0; i < latLng.length; i++) {
        var loc = latLng[i].split("|");
        if (marker.length > maxOverlays)
        addMarker(loc[0], loc[1]);
        }, i*200);

© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.