javascript - Multiple map implementation in php -


i used multiple marker map in website , added static data coming fine ,i want convert sttaic dynamic per db .

var features = [     {         position: new google.maps.latlng(26.820553,30.802498000000014),     },      {         position: new google.maps.latlng(24.770300473681075,46.384158004687485),     },      {         position: new google.maps.latlng(26.820553,30.802498000000014),     },      {         position: new google.maps.latlng(21.788924411377383,57.10016540039055),     },      {         position: new google.maps.latlng(20.593684,78.96288000000004),     } ]; 

i getting location array using foreach , how can implemets above map code ,

array (     [0] => array     (         [name] => xyz         [lat] => 24.7970581         [lng] =>  46.7004561     )     [1] => array     (         [name] => xyz         [lat] => 24.7970581         [lng] =>  46.7004561     ) ) 

encode array json in php , loop through in js

var json = <?php echo json_encode($arr) ?>; //$arr array   var data = [];      for(var of json){         data.push({         position: [i.lat,i.lng]        })      }      console.log(data); 

Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -