Guest User

Untitled

a guest
Feb 21st, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. function getLocation(){
  2.  
  3. var url = 'https://opensky-network.org/api/states/all?time=1458564121&icao24=3c6444'
  4.  
  5. return fetch(url) // Call the fetch function passing the url of the API as a parameter
  6. .then(function(resp){
  7. data = resp.json() // Transform the data into json
  8. return data
  9. }).then(function(data) {
  10.  
  11. lat = data.states[0][5]
  12. long = data.states[0][6]
  13. lat = lat.toString()
  14. long = long.toString()
  15. location = [lat,long]
  16. return location
  17. })
  18. }
  19. }
Add Comment
Please, Sign In to add comment