# Random Quote Machine (Help with Retrieving Random Quotes)

**URL:** <https://forum.freecodecamp.org/t/random-quote-machine-help-with-retrieving-random-quotes/22182>\
**Category:** I Built This\
**Created:** [July 22, 2016, 6:16pm UTC](https://forum.freecodecamp.org/t/random-quote-machine-help-with-retrieving-random-quotes/22182 "2016-07-22T18:16:05Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![mmassie23](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/mmassie23/32/68528_2.png) [@mmassie23](https://forum.freecodecamp.org/u/mmassie23)\
**Post date:** [July 22, 2016, 6:16pm UTC](https://forum.freecodecamp.org/t/random-quote-machine-help-with-retrieving-random-quotes/22182/1 "2016-07-22T18:16:06Z")

</div>

```
  Hey guys if possible I could use some assistance with the Random Quote Machine Intermediate Project. My call to the API works, however, it receives the same quote with every call. Would I need to manipulate the jquery code (e.g. Math.random, for loop, etc) or change the URL specified in the getJSON function, or maybe something entirely different.
 Here is my code: [https://codepen.io/mmassie23/pen/YWZbYy](https://codepen.io/mmassie23/pen/YWZbYy). I am using the [Quotes On Design](https://quotesondesign.com/api-v4-0/) API. Any suggestions would be heavily appreciated and I also want to thank you for your time :smile:
```

---

<div class="post-metadata">

**Author:** ![BenGitter](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/bengitter/32/12192_2.png) [@BenGitter](https://forum.freecodecamp.org/u/BenGitter)\
**Post date:** [July 22, 2016, 6:19pm UTC](https://forum.freecodecamp.org/t/random-quote-machine-help-with-retrieving-random-quotes/22182/2 "2016-07-22T18:19:50Z")

</div>

See this post, should work for you as well.

> **[In need of help with my 'new quote' button and my tweet button \[Solved\]](https://forum.freecodecamp.org/t/in-need-of-help-with-my-new-quote-button-and-my-tweet-button-solved/21322/2)**
>
> Hey, add this line of code directly after your document ready: $.ajaxSetup({ cache: false }); This will make sure that the browser doesn’t fetch a cached result, when you run a ajax/json request.

---

<div class="post-metadata">

**Author:** ![mmassie23](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/mmassie23/32/68528_2.png) [@mmassie23](https://forum.freecodecamp.org/u/mmassie23)\
**Post date:** [July 22, 2016, 6:27pm UTC](https://forum.freecodecamp.org/t/random-quote-machine-help-with-retrieving-random-quotes/22182/3 "2016-07-22T18:27:41Z")

</div>

> [@BenGitter](#):
>
> $.ajaxSetup({ cache: false });

Thank you very much it works! However, it only did so when I changed the URL from https - http. Would you happen to know why that is (sorry, just very curious)?

---

<div class="post-metadata">

**Author:** ![BenGitter](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/bengitter/32/12192_2.png) [@BenGitter](https://forum.freecodecamp.org/u/BenGitter)\
**Post date:** [July 22, 2016, 6:33pm UTC](https://forum.freecodecamp.org/t/random-quote-machine-help-with-retrieving-random-quotes/22182/4 "2016-07-22T18:33:00Z")

</div>

Most browser don’t allow http requests if your website uses https.

---

<div class="post-metadata">

**Author:** ![mmassie23](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/mmassie23/32/68528_2.png) [@mmassie23](https://forum.freecodecamp.org/u/mmassie23)\
**Post date:** [July 22, 2016, 6:34pm UTC](https://forum.freecodecamp.org/t/random-quote-machine-help-with-retrieving-random-quotes/22182/5 "2016-07-22T18:34:11Z")

</div>

Oh I didn’t know that. Once again thanks you very much for your assistance.

---

<div class="post-metadata">

**Author:** ![JamieCallis](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/jamiecallis/32/74325_2.png) [@JamieCallis](https://forum.freecodecamp.org/u/JamieCallis)\
**Post date:** [October 1, 2017, 6:21pm UTC](https://forum.freecodecamp.org/t/random-quote-machine-help-with-retrieving-random-quotes/22182/6 "2017-10-01T18:21:37Z")

</div>

> [@BenGitter](#):
>
> $.ajaxSetup({ cache: false });

I was about to write up my own thread to get feedback, and it gave me this to look at. I added the ajax line of code, and it works.

I am taking it that because it is caching the data its, then retrieving the cached data? Could you explain this to me?

---

<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:** [June 1, 2021, 2:28pm UTC](https://forum.freecodecamp.org/t/random-quote-machine-help-with-retrieving-random-quotes/22182/7 "2021-06-01T14:28:28Z")

</div>

Closed on June 1, 2021, 2:28pm UTC


