[solved] Help me understand this API

Hi everyone,

I’m working on trying to understand how this API works but I just can’t wrap my head around it. Here’s my very simple codepen.


How do get a random quote from the API?

Hi, here’s only what I’ve found over the last 20 minutes or so:

I’ve separated your function calling on the api from the onclick.
$('#btn).on('click', getquote);
function getquote(){};

It still wouldn’t work so I’ve replaced your url with mine and it works fine.

Whereas just replacing the url but keeping the original code doesn’t work.

So it still looks like your url doesn’t work very well - it needs refreshing every time - I don’t know if it has to do with caching or something like that…

The API I’ve used is this one: http://quotes.stormconsultancy.co.uk/random.json

But maybe let someone else pitch in because I have a feeling this is not very helpful :slight_smile:

1 Like

Thanks for the help but I’ve actually got it working. Here’s my codepen if interested

Just need to style it now

Great ! Really cool !
[just for my posterity already in bad shape, I tried your api with 1 per page and not 4 so I wouldn’t have iterate through the array :slight_smile:]