# Random Quote Generator - API call in CodePen returns same value every time

**URL:** <https://forum.freecodecamp.org/t/random-quote-generator-api-call-in-codepen-returns-same-value-every-time/149678>\
**Category:** General\
**Created:** [September 24, 2017, 4:29pm UTC](https://forum.freecodecamp.org/t/random-quote-generator-api-call-in-codepen-returns-same-value-every-time/149678 "2017-09-24T16:29:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![geminiX](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/geminix/32/41391_2.png) [@geminiX](https://forum.freecodecamp.org/u/geminiX)\
**Post date:** [September 24, 2017, 4:29pm UTC](https://forum.freecodecamp.org/t/random-quote-generator-api-call-in-codepen-returns-same-value-every-time/149678/1 "2017-09-24T16:29:49Z")

</div>

In CodePen, my API call is returning the same quote every time, but when I run the GET request outside CodePen in Postman, it does give a random quote. And I see other people using this API on CodePen, so it’s something wrong with my implementation… any help is appreciated.

> **[Random Quote Generator - API issue snapshot](https://codepen.io/geminix/pen/wropWV)**
>
> ...

---

<div class="post-metadata">

**Author:** ![camperextraordinaire](https://avatars.discourse-cdn.com/v4/letter/c/5f9b8f/32.png) [@camperextraordinaire](https://forum.freecodecamp.org/u/camperextraordinaire)\
**Post date:** [September 24, 2017, 8:09pm UTC](https://forum.freecodecamp.org/t/random-quote-generator-api-call-in-codepen-returns-same-value-every-time/149678/2 "2017-09-24T20:09:53Z")

</div>

QuotesByDesign cache’s the response unless you specifically tell the API not to. The easiest way to accomplish this is not put the following inside (at the top) of your $(document.ready callback function.

```auto
$.ajaxSetup({ cache: false });

```

This will force all the AJAX calls to the API to not cache the response, so you will get a new quote each time.

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [January 17, 2021, 8:39pm UTC](https://forum.freecodecamp.org/t/random-quote-generator-api-call-in-codepen-returns-same-value-every-time/149678/3 "2021-01-17T20:39:05Z")

</div>

Closed on January 17, 2021, 8:39pm UTC


