Javascript GET JSON data from API
I think I've got myself in a muddle with something I thought would be fairly simple. I am trying to return the name and status of a ground station from and API. I want to display this in a browser. The Repl is here https://repl.it/@g7kse/SatNOGS-Javascript.
I could do with a pointer. I followed a few tutorials and its not really doing what it ought to. You will see that coding is not my chosen specialist skill ;-)
I have a feeling it has to the with the data being in [0] and [antenna]. Is that correct?
for XMLHttprequests, use req.onload
to get when the request is done and use req.responseText
or req.response
to get the result
example:
let req = new XMLHttpRequest() req.open("GET", url) req.send() req.onload = function() { console.log(req.responseText) }
Thanks @MrEconomical. That was very quick!
@g7kse if @MrEconomical answered your question, be sure to mark his comment as the answer!
nks for sharing the article, and more importantly, your personal experience mindfully using our emotions as data about our inner state and knowing when it’s better to de-escalate by taking a time out are great tools. App https://shareit.onl/ reciate you reading and sharing your story since I can certainly relate and I think others can to
Here is the proper way to do it using the well supported and modern ** fetch ** function: https://repl.it/@freddiethefrog/SatNOGS-Javascript
Ta @freddiethefrog & @MrEconomical
Couldn't have done that in a week without the pointers. Brilliant. Thanks
5 points each surely!
@g7kse: Cool!