What is the “proper” way to complete this project? I’ve seen people using array’s and some using API’s to pull in the random quotes. I assumed they wanted us to use API’s since that’s what the previous 7 assignments covered.
Or, should I even worry about the “proper” way to do it as long as it runs successfully?
I believe it is up to you. I used an array to store a bank of quotes in lieu of a database, while others are pulling down quotes from an external API. As long as you fulfill the written requirements you are golden.
I used an array for mine too. I don’t think it is as important that you use an API for this one, more that you get experience incorporating your algorithm thinking. I think that the following three projects after this one give you plenty of opportunities to work your API/json muscles.
afaik, .getJSON is a recommended wrapper around .ajax. I’m glad Freecodecamp kept it simple with using this only. If for some reason FCC material didn’t click for you, maybe this jQuery Ajax Tutorial #1 video will.
It covers quickly and clearly four levels of async JS - It’s so good you don’t have to read this, read that and read more to figure which is better. Together with .getJSON, you know five
I used an API for mine, as I thought that by this point in FCC we were maybe getting our training wheels taken off and were expected to go do a bit of research on our own to figure out how to make a particular API work. This is my finished one if you wanted to see one done with API. You need to actually open it in codepen, not run it in the thumbnail for some reason:
My solution was to put my quotes in a json file that lives in my public Dropbox folder, and then make an ajax call to retrieve it. I guess it’s kind of a hybrid between using an array in the javascript and using an API.
My understanding is that as long as it satisfies the user stories, it should pass.
I think the correct way to complete this challenge is using Random Famous Quotes api.
I think the problem is ajax request.
I have trouble how to request.
I found sample code to execute this request in this link.
Thanks for posting this; I have been struggling for a week now with this and I finally got something to show up by going through your scripts. It’s becoming slightly less gray for me! Yay. Thanks again.
I used an array. I’m still not very clear on APIs so I might do some external studying for a while before jumping on the weather project. My understanding is that FCC wants us to complete each project/challenge in our own unique way and that there isn’t necessarily any “right” way.
Hi, I did the same thing by myself but I used the ajax function but I got an error due to the reasons related to CORS,Please advice on the matter.Thanks
Why is there question marks in the url that you use? I realised that, and realised that you have to declare the getQuote function before using it; otherwise, it won’t work. Could you explain these slight differences? I’m kind of confused. Thanks in advance for your help, your pen helped me quite a bit. Oh yeah, also with your jQuery generator button, your .on(‘click’, function(){}) didn’t work, I changed it to .click(function(){}) and it worked. Don’t know why but it works though.