Hi there. I’ve finished my random quote machine. When I finished with it, I was initially please with the result. It worked well (or so I though), but under more thorough examination it seems to have a number of significant problems:
Firstly, I couldn’t figure a way to remove the quotation symbols from around the originator of the quote. I tried .replace but to no avail.
Secondly, it appears that the quotes seemingly aren’t refreshed when I share the code with other people… Could anyone she any light on this?
Thirdly, if there is no author returned ("") with the JSON, my if statement doesn’t catch this. Is there a way to make the if statement work? I tried assigning it to a variable, but again to no avail.
I had a look at the example quote machine and saw that it used an AJAX implementation?
Running the code on Microsoft’s Edge browser it now runs flawlessly. However, when I go back to Chrome, I get the same quote over and over gain. Could it be something to do with AdBlocker or something?
For people looking for a solution to the only loading a single quote problem, if you add $.ajaxSetup({ cache: false }); after $(document).ready(function()), it stops the quotes been taken from the cache.
I have now sorted all the problems with my JavaScript. My pages looks as ugly as hell, but at least it works. I may try to beautify it later.