S
system
Guest
Kako najlakše da grabujem podatke iz json fajla:
https://public-api.adsbexchange.com...t=33.433638&lng=-112.008113&fDstL=0&fDstU=100
Probao sam ovako pomoću js, ali ne uspevam, nije bitno koji podatak, samo da znam gde grešim. Recimo treba mi ‘Id’ … evo mog js:
[/CODE]
Dobijem izlaz: undefined
https://public-api.adsbexchange.com...t=33.433638&lng=-112.008113&fDstL=0&fDstU=100
Probao sam ovako pomoću js, ali ne uspevam, nije bitno koji podatak, samo da znam gde grešim. Recimo treba mi ‘Id’ … evo mog js:
Code:
var x = document.getElementById(‘loc’);
[CODE] function getLocation() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(showPosition);
} else {
x.innerHTML = 'Geolocation is not supported by this browser.';
}
}
function showPosition(position) {
x.innerHTML = 'Latitude: ' + position.coords.latitude +
'<br>Longitude: ' + position.coords.longitude;
var myJSON = 'https://public-api.adsbexchange.com/VirtualRadar/AircraftList.json?lat=33.433638&lng=-112.008113&fDstL=0&fDstU=100';
document.getElementById('loc2').innerHTML = myJSON['acList'][0]['Id'];
}
Dobijem izlaz: undefined