Hey, you might want to use html() instead of replaceWith(). Because if you execute the replaceWith the $("#qod-quote") is replaced, so on the next call of the function $("#qod-quote") doesnot exist anymore and can’t be replaced with the new quote.
The real “problem” is the fact that your requested is cached. So every time you make that request it will simply be fixed from the cache. To prevent this you can change $.ajaxSetup or change this line: $.getJSON("http://quotesondesign.com/wp-json/posts?filter[orderby]=rand&filter[posts_per_page]=1&callback="
to: $.getJSON("http://quotesondesign.com/wp-json/posts?filter[orderby]=rand&filter[posts_per_page]=1&random=" + Math.random() + "&callback=".
This makes sure that every request is unique and not fetched from the cache.
Hi, if you take a look to stackoverflow.com I think you will find some discussion about this issue, anyhow it seems that the browser calls the API only the first time and saves it in its cache. To prevent this behavior you should add to the url a timestamp +new Date().getTime(); this will make the url unique every time that you press the button, eluding your browser’s cache. I hope this could be helpful.
Yes, it does. So, technically you could get two of the same numbers. But since it returns a number with so many decimals (e.g. 0.0500289405198695), this is very unlikely.
You could use anything as a parameter (name and value doesn’t matter) as long as they are different every time.