Twitch json api: api calls not showing on console

Twitch json api: api calls not showing on console
0.0 0

#1

Hi,

I am experiencing difficulties trying to display my json results.

I started working on the twitch json api project here:

although Chrome devtools is showing the json in the network tab and I get results using the link in postman, I can’t get the json to render in the console of codepen.

please help.

thanks in advance.


#2

You misspelled the word success. By the way why do you set async: false ? That just against the very idea of ajax calls :wink:


#3

Wow, thanks for your quick reply.
I must have spelled it wrong because the same word exists in dutch but with 1 “s” at the end.
It appears to be working now!

About the async: I used it while building the wikipedia app. The youtube channel coding tutorials 360 mentioned this should be set to false. I should read into this!

Again, many thanks!


#4

No problem :wink: of course there may be some cases where you may want to execute ajax synchronously but I honestly don’t remember ever doing that. Out of curiosity I checked the video you mentioned https://www.youtube.com/watch?v=dRZxQY2RgUA and the guy realy says:

This “async”… I wish I could explain it in more detail…uhm it’s just data thing and I don’t fully understand it

LMAO :joy:
Short explanaition. When you set async: true your code doesn’t wait for the response of ajax call and your application keeps running while the data is being requested from a remote server in the background.
When you set async: false the code executions stops until you get a response from a remote server. If JSON (or whatever else) you’re requsting is a large file or simply your internet connection is slow it means your app freezes and becomes unresponsive until it finishes fetching data. Setting it to false would only make sense if the data you’re requesting is crucial for your app to keep on running. The guy in the video also says about “async” that it

 works when it's false

Not true. When it’s false its behaviour is just more predictable and easier to debug.


#5

I was hesitant adding the link to my comment about the video. Didn’t think you’d bother watching it :grin:
Although the guy helped me understand a few things, abviously he should concider looking up what async does. :joy: .

Thanks for your clear explanation! Saves me the trouble searching for it.