php - Unable to access array inside geocoder -
i have array outside geocoder, when want use array inside geocoder values of array undefined
var titles = new array(<?php echo implode(",",$titles); ?>); var length = postcode.length; (var = 0; < length; i++) { geocoder.geocode({'address': postcode[i]}, function(results, status) { if (status == google.maps.geocoderstatus.ok) { lat2 = results[0].geometry.location.lat(); lng2 = results[0].geometry.location.lng(); var latlng = new google.maps.latlng(lat2, lng2); var marker = new google.maps.marker({ position: latlng, map: map, title: titles[i], icon: icon}); // alert(titles[i]) - undefined } } }
you
var titles = <?php echo json_encode($titles); ?>;
Comments
Post a Comment