Help - code works on visual studio but not on code pen - quote machine

Help - code works on visual studio but not on code pen - quote machine
0

#1

My code is working on visual code but not on code pen. I reviewed all the libraries and they are inserted.

Could somebody help me?


#2

Always check your console for errors.

You’re trying to access an insecure resource (quotesondesign) from a secure site (codepen). There are a couple of things you need to do to fix this. First, use an HTTPS proxy. https://cors-anywhere.herokuapp.com/ works. Put that in front of your quotesondesign url. Also, since you’re using HTTPS now, you don’t need that JSONP stuff any more. Remove it from your configuration object and your URL. The final URL will look like this

var url = "https://cors-anywhere.herokuapp.com/http://quotesondesign.com/wp-json/posts?filter[orderby]=rand&filter[posts_per_page]=1"

#3

Just add an s in front of http inside your click function.