# Update API with Ajax

**URL:** <https://discuss.dev.twitch.com/t/update-api-with-ajax/25698>\
**Category:** API\
**Created:** [May 17, 2020, 9:52pm UTC](https://discuss.dev.twitch.com/t/update-api-with-ajax/25698 "2020-05-17T21:52:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Emanuele\_Capizzi](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/emanuele_capizzi/32/6915_2.png) [@Emanuele\_Capizzi](https://discuss.dev.twitch.com/u/Emanuele_Capizzi)\
**Post date:** [May 17, 2020, 9:52pm UTC](https://discuss.dev.twitch.com/t/update-api-with-ajax/25698/1 "2020-05-17T21:52:16Z")

</div>

Hi, how i can autoupdate every 1000ms with ajax any div contain api and no break my code?

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [May 18, 2020, 11:31am UTC](https://discuss.dev.twitch.com/t/update-api-with-ajax/25698/2 "2020-05-18T11:31:13Z")

</div>

If you are doing it that quick, don’t use setInterval

Run a request, when the request completes start the next one.

Or collect events via other means and push that to the front end.

Which API’s are you trying to call?

---

<div class="post-metadata">

**Author:** ![Emanuele\_Capizzi](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/emanuele_capizzi/32/6915_2.png) [@Emanuele\_Capizzi](https://discuss.dev.twitch.com/u/Emanuele_Capizzi)\
**Post date:** [May 18, 2020, 10:15pm UTC](https://discuss.dev.twitch.com/t/update-api-with-ajax/25698/3 "2020-05-18T22:15:56Z")

</div>

Onlive member list with views on “realtime”

---

<div class="post-metadata">

**Author:** ![Dist](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/dist/32/7192_2.png) [@Dist](https://discuss.dev.twitch.com/u/Dist)\
**Post date:** [May 18, 2020, 10:33pm UTC](https://discuss.dev.twitch.com/t/update-api-with-ajax/25698/4 "2020-05-18T22:33:43Z")

</div>

The Twitch API uses caching, so the closest you’ll get to updating viewer count in real-time would be by polling the API once a minute.

---

<div class="post-metadata">

**Author:** ![system](https://d2opxh93rbxzdn.cloudfront.net/original/2X/0/05909729875cce3b53e59d5561c4d23bb14948fc.png) [@system](https://discuss.dev.twitch.com/u/system)\
**Post date:** [June 17, 2020, 10:33pm UTC](https://discuss.dev.twitch.com/t/update-api-with-ajax/25698/5 "2020-06-17T22:33:45Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
