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

Popular posts from this blog

c# - SelectList with Dictionary, add values to the Dictionary after it's assigned to SelectList -

how can i manage url using .htaccess in php? -

ios - I get the error Property '...' not found on object of type '...' -