Im stuck in Intermediate front end development projects

It’s like a wall i cant climb no matter how hard i tried. It’s been like that for days.
I even took a look at the codepen example an still dont understand half of the JS code in there.

First of all I think they dont explain what exactly is an API, why does it matter and how to use it.
Also there’s a lot of concept in the code (like try, typeoff, json.parse, etc…) that haven’t been explain before in this course and i have no idea what that does.

Can someone pls help me, cuz I honestly have no idea where to start.

Here are some resources for APIs:

  1. https://medium.com/@lilpump/beginner-tutorial-to-web-apis-how-to-get-started-fast-498773cb3b6b
  2. https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Client-side_web_APIs/Introduction
  3. https://www.codecademy.com/ru/tracks/apis-web

I would read those in that order.

1 Like

Learning how API works for the first time, even with jquery, can be a struggle. I know it was for me, but once you do it opens up such a huge landscape of possibility and feels like you really level up once you learn it.

You will have to find some outside resources.

For my quotes project I used one of jquerys shorthand methods for AJAX which simplifies the process.
https://api.jquery.com/jQuery.getJSON/

I used the http://forismatic.com/en/api/ to get my quotes.

Here is a simple example of what you need to do to get quote data if you choose to use jQuery:

$.getJSON(url, function(data) {
  console.log(data); // data will be the response from the requested url
}

The base of the url for this api is "http://api.forismatic.com/api/1.0/" but you will have to add on to that the URL-encoded query parameters.

The query parameters you need to add are shown in the forismatic link above.

You will have to figure out which query parameters you need and how to url encode them and append them to that base url.

I don’t want to rob you of the learning experience so I won’t say anymore and hopefully the info will give you some direction.

1 Like

been reading this links for a few days. I think im 30-40% of the way to understanding this exercise. Thanks, it was really helpful