hey i have latitude and longtitude data that i put in database can i get that data and put it in javascript code to process with map api?
here is my javascript code that i want to change the "latitude and longtitude" in database
<script type='text/javascript'>
jsMaps.loader(function (){
var tiles = new jsMaps.Native.Tiles();
var map = jsMaps.api.init(
'#map',
'native',
{
center: {
latitude: (change data from database),
longitude: (change data from database)
},
zoom: 14,
mouse_scroll: true,
zoom_control: true,
map_type: true
},tiles
);
var polyLine1 = [
{lat: (change data from database),lng: (change data from database)},
{lat: (change data from database),lng: (change data from database)},
{lat: (change data from database),lng: (change data from database)},
{lat: (change data from database),lng: (change data from database)}
];
so i made json file to grab data that i need to process to javascript. Then i use async funtion to extract json file and obtain latitude and longtitude from database. here is my javascript code to extract the json file :
const api_url = 'jsonlatest.php'
async function getjsonlatest() {
const response = await fetch(api_url);
const data = await response.json();
let i = 0;
while (i<10) {
i++;
array = JSON.parse(JSON.stringify(data[i]))
sip = [array.latitude, array.longtitude]
oke = [sip]
console.log(oke)
}
}