Hi everyone!
I am tinkering around with the Deck Of Cards API and I built a simple app (link below), which is meant to create a shuffled deck of cards, then reveal a button that the user can push to show the next card in the deck.
When I run the app it calls getDeck, which uses startWebRequest to get a deck of cards, initialize a global variable with the deck ID, then reveals a button for the user to click. This works as expected.
When I click the button the event handler uses the deck ID (stored in the global variable) and startWebRequest to retrieve a card and show the image of that card. This also works as expected.
However, when I click the button a second time it just returns the same card while I expect it to retrieve and show a new card.
When I paste the card-draw url (copied from my console.log statement with the current deck ID) into my browser it behaves exactly as I expect: it gives a different card and decrements the “remaining” member by one. When I reload, it again gives a new card and decrements “remaining” as expected.
Why is my event handler not actually retrieving the next card?
Thanks in advance!