I’m really struggling on the random quote generator API and am looking for help. I’ve worked on it all today/yday trying to find a solution but I can’t seem to find out.
Right now I don’t want to format the data, I just want to get my data into the header! I’ve copied the url into a browser which brings up a random quote, I’ve also passed the $.getJSON into the console which did bring in some data, but then I couldn’t get the button/click event to work to pass through to the header.
If this is a button issues over a JSON query I will be very upset…
what kind of console errors if any are you getting? I am looking at it now and am getting some, but wondering what you are seeing and what you have tried so far?
EDITED to add: I know you’ve been trying all day…what’s showing RIGHT NOW in your console?
I’m getting some different console errors in Chrome, but can’t get past this error even when I address a few other ones:
Refused to execute script from 'https://api.forismatic.com/api/1.0/?method=getQuote&format=json&lang=en&callback=jQuery31104296265560980701_1493763287940&_=1493763287941' because its MIME type ('application/json') is not executable, and strict MIME type checking is enabled.
I know this is an error that’s come up a lot and I’ve not been successful yet fixing it (having just spent 10-15 min on it). Reading this now:
The console should be showing you errors. Try using chrome for it’s debugging tools for a few projects.
Try running my pen (a fork of yours) in safari or mozilla, does it work for you?
yeh that one works. Ive tried it in Chrome as well but its the same as safari. I get nothing in the codepen console, i don’t know if I’m doing it wrong or looking in the wrong place, but console is always blank unless i type into it myself.
this looks really nice and clean, good work! I tried implementing your solution in a fork of the OP’s pen, and I still can’t get it to work. Can you spot any errors here? Even though i’ve done this project, I’d still like to konw why I can’t fix the OPs pen!
Thanks for all your help. Unfortunately I still couldn’t get it to work. I tried Chrome, putting in jsonp, putting in the heroku line, removing the callback section, trying the other example api and i got nothing. I’m going to try something else for a while before my computer goes out the window.
Thanks again for your input though, all your efforts to help are very much appreciated!
Don’t worry about it Im on the weather app and the JSON call is a nightmare… theres some technical wizardry we weren’t prepared for, if you simply followed the lessons.
My suggestions is start “googling” AJAX JSON call et al… are try and teach yourself this stuff from multiple angles/sources.
On the plus side, this is where most of the “Theory” starts to sink in (and all the jibber jabber will start to have meaning)… it will roll around your head and you’ll start thinking about it from multiple angles.
Good luck… remember they put a picture up of someone punching their screen for a reason.