Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getLocation(){
- var url = 'https://opensky-network.org/api/states/all?time=1458564121&icao24=3c6444'
- return fetch(url) // Call the fetch function passing the url of the API as a parameter
- .then(function(resp){
- data = resp.json() // Transform the data into json
- return data
- }).then(function(data) {
- lat = data.states[0][5]
- long = data.states[0][6]
- lat = lat.toString()
- long = long.toString()
- location = [lat,long]
- return location
- })
- }
- }
Add Comment
Please, Sign In to add comment