How to perform Ajax call first to get lat/lng and then load Google maps with markers?
问题 I am doing an ajax call to retrieve the lat and lng of stores locations stored in sql database. This is my ajax call and returns the json object of all lats and lngs. $.ajax({ type:"GET", dataType:"json", url:"<?php echo site_url("sandbox_faizan/get_coordinates") ?>", success: function(result) { my_arr = result; for(var i=0;i<result.length;i++) { store_points(result[i].lat,result[i].lng) } }); Now I have stored this json object in my own array object that will be used to add markers on map.