Random Quote Generator API Help

Hello, my random quote generator works as in it calls a random quote when I click the button and adds it to the html. My issue is that it only works one time and my “re-clicking” of the button does nothing except change the color (which is a good thing).

Any help would be great!

jQuery’s $.getJSON method automatically caches every request. This means that after 1 request, it always uses that data.

You prevent the caching of your data:

  1. By writing this line of code before your Ajax call $.ajaxSetup({ cache: false });.
  2. By using $.ajax and setting cache to false.

More info about $.ajax: http://api.jquery.com/jquery.ajax/

1 Like

You are a live saver! Thanks so much!