Skip to content
Sign upLog in
This post is read-only. Explore Repls and connect with other creators on Community.View Community
The info in this post might be out of date, check out our docs instead. View docs
1

Javascript GET JSON data from API

g7kse
g7kse

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?

3 years ago

Voters

Comments

TopNew
1

Here is the proper way to do it using the well supported and modern ** fetch ** function: https://repl.it/@freddiethefrog/SatNOGS-Javascript

3 years ago
1
g7kse
g7kse

Ta

@freddiethefrog
&
@MrEconomical

Couldn't have done that in a week without the pointers. Brilliant. Thanks

5 points each surely!

3 years ago
4
eco27
eco27

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) }
3 years ago
1
g7kse
g7kse

Thanks

@MrEconomical
. That was very quick!

3 years ago
1
Vandesm14
Vandesm14

@g7kse
if
@MrEconomical
answered your question, be sure to mark his comment as the answer!

3 years ago
1
MunnaKabir
MunnaKabir

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

9 months ago
Load more