Y
Y
Yurii Donnykov2022-03-16 17:36:44
JavaScript
Yurii Donnykov, 2022-03-16 17:36:44

API update without page reload?

Help an inexperienced jun..!
In the test task, a random api was attached ( https://www.colr.org/json/color/random ). The API each time returns a random object that should be drawn on the page, there is a skip button, the object returned to the API should be updated on click. The API should be called once on page load, the skip button should be updated randomly.
I can not understand how the API update is implemented if the API call is made only 1 time when the page is loaded.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladimir Korotenko, 2022-03-16
@firedragon

bind the API call to the skip button, or add the missing property to the collection and do not display it

T
Tatyana Dzhanaeva, 2022-03-17
@DjanTanKa

as I understand it, the point is that when you enter the page for the first time - of course, pull the apishka (in the user effect), so that something is immediately displayed. and then, on click (randomly) on the button, also call the same API every time to update the object

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question