As explained in the title, i’m struggling through them using help from the forum but I really feel like I don’t have a good fundamental understanding of AJAX and API’s to do them. I’ve tried looking up lots of resources but a lot are advanced or don’t explain the right thing so I’m struggling to find a good place to learn this stuff to help me with the challenges.
All I know is all I know from working the challenges here at FCC. To me, it’s one of those learn by doing exercises. Find a good API with good documentation, (I think google maps is pretty well documented) and play with it in some practice code. Run it in debug mode and while the object of your API code is in scope, type in the name of the object in the console. See what it contains. That was extremely helpful to me.
ye i was confused when i got to this section … and when i got it sorted i realized there wasnt much too it … was obvious but i missed it lol … found this video and after watching it i was sorted so hopefully with this plus whats above you will be too.
Just keep plugging away at it. If you have a specific question about it, ask here. Be sure to let us know where you are: IE, are you getting a JSON response and you don’t know how to access data in it, or are you getting errors in your data request?
function loadVideo() {
var myKey = "enter your key as a string here";
var request = 'https://www.googleapis.com/youtube/v3/search?part=snippet&maxResults=10&order=viewCount&publishedAfter=2016-01-01T00%3A00%3A00Z&q=teaser%7Ctrailer&type=video&videoCaption=any&videoCategoryId=24&videoEmbeddable=true&key=' + myKey;
$.ajax({
url: request,
success: function (data) {
//do stuff with data, such as display it somewhere
}
});
}
I completely understand where your at and am still kind of there myself but am a lot clearer now that I have worked through 4 API projects. For me learning how to use console log and putting the code on full screen (if your using code pen) and going into developer options to see the logs and/ or error messages really helped a lot. There are a lot of good tutorials on using developer tools online (assuming you don’t use them already) Also like some other people said, once you figure out a specific problem (like request denied error 504) post it here/ on reddit) until you get the hang of it.
Thanks everyone for your help. I think where I’m getting stuck is with the API, I don’t think I’m calling it right or something as I don’t seem to be getting anything from my get request. Here’s my code