Can anyone help me figure out where my error is coming from? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Can anyone help me figure out where my error is coming from?

I am trying to use an API to build a random quote generator. The button is working it accesses the function but the codes are not changing. This is my code: https://code.sololearn.com/W5DvH5IGfC3p the button works but I am not sure why the API is not working

29th Jun 2017, 1:53 AM
Kevin Oudai
Kevin Oudai - avatar
2 Answers
+ 2
Change your api link to this: url: 'https://cors-anywhere.herokuapp.com/http://quotesondesign.com/wp-json/posts?filter[orderby]=rand&filter[posts_per_page]=1',
29th Jun 2017, 2:51 AM
Calviղ
Calviղ - avatar
+ 2
works really well now thank you. I will have to keep that header in mind.
29th Jun 2017, 1:04 PM
Kevin Oudai
Kevin Oudai - avatar