I am stuck on Random Quote Machine

I am stuck on Random Quote Machine
0
#22

It may be better to change the API call to "https://crossorigin.me/http://api.forismatic.com/api/1.0/?method=getQuote&lang=en&format=jsonp&jsonp=?". It’s a hack, but at least users won’t have to think about whether they’re connected securely or not.

#23

ohhh my goodness! you right man :slight_smile: it is my browser. Now works. Thank you so much my friend :slight_smile: you are very helpful.

#24

By the way I appreciate also @mikeale03 . Thank you very much for your help.

#25

Hey guys,

I think I am experiencing some problem with CORS or maybe some with my code. Can you help me with some tips or something so I can “un-stuck”?
In the console I have the message: XMLHttpRequest cannot load, The ‘Access-Control-Allow-Origin’ header has a value ‘http://null’ that is not equal to the supplied origin. Origin ‘null’ is therefore not allowed access.

Thanks a lot guys

EDIT 1 I changed my API and it worked. Thanks for the responses above! I appreciate any inputs. Thanks a lot

    function output(){
$.getJSON("http://quotesondesign.com/wp-json/posts?filter[orderby]=rand&filter[posts_per_page]=1&_jsonp=mycallback", function(a) {
        
        $("#quote").html(a[0].content);
        $("#quoted").html(a[0].title);
                        })};
        
       $("#getQuoteButton").click(output());

EDIT 3

#26

similar:
$.getJSON(“http://api.forismatic.com/api/1.0/?method=getQuote&lang=en&format=jsonp&jsonp=?",function(json){
quote = json;
$(”#quote").html(quote.quoteText);
$("#quoteAuthor").html(quote.quoteAuthor);
});