call json location ajax google maps -


i have json data loction {"name":"tiesna","latitude":"123456","longitude":"9876543","posisi":"cirebon","waktu":"2015-07-01 21:49:52"}{"name":"jastin","latitude":"-1234567","longitude":"987654","posisi":"susukan","waktu":"2015-07-01 23:11:52"}

i want call google maps location

var locations = [   ['bondi beach', -33.890542, 151.274856, 4],   ['coogee beach', -33.923036, 151.259052, 5],   ['cronulla beach', -34.028249, 151.157507, 3],   ['manly beach', -33.80010128657071, 151.28747820854187, 2],   ['maroubra beach', -33.950198, 151.259302, 1] ];  var map = new google.maps.map(document.getelementbyid('map'), {   zoom: 50,   center: new google.maps.latlng(-39.92, 151.25),   maptypeid: google.maps.maptypeid.roadmap });  var infowindow = new google.maps.infowindow();  var marker, i; var markers = new array();  (i = 0; < locations.length; i++) {     marker = new google.maps.marker({     position: new google.maps.latlng(locations[i][1],                                       locations[i][2]),     map: map }); 

i'm still having little trouble understanding asking, help...

if have js object following

var loc1 = {"name":"tiesna","latitude":"33.890542","longitude":"151.274856"}; 

you can push relevant properties array following:

var locations = []; locations.push([loc1.name, loc1.latitude, loc1.longitude]); 

Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -