Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

HTML, CSS, JS, Async/Await. Added Features!!

James 510

@Auddity

Desktop design screenshot for the Advice generator app coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
  • API
2junior
View challenge

Design comparison


SolutionDesign

Solution retrospective


Since this API has a search object, I went ahead and added that feature.

  • Enter a keyword and the first result matching that keyword will be displayed.
  • If there is no match for the keyword you'll see the message provided by the API telling you no match could be found.

I will update this to return a random advice slip from the API if there is more than one match.

Another thing I added was the dice image spinning while we await a response from the API if the network is slow.

Community feedback

P

@ToniHunter274

Posted

Kudos bro.. This is amazing. I'm also working on this project but I'm having on how to integrate an API into a webpage...Please any tips you could give me would be highly appreciated.

0

James 510

@Auddity

Posted

@ToniHunter274 Thanks! I appreciate that.

What part of the process are you having an issue with? Fetching the data or getting the data to display on screen?

There's a few ways to make a request to an API. On this project I used Async/Await and put the fetch method in a try/catch block. It's a more strait forward way for handling the response from the API.

To get a good understanding of the process you should study XMLHttpRequest and handling Promises in Asynchronous JavaScript (AJAX).

For displaying the data, it depends on the API provider and it's structure. At the heart of that is knowing how to access object properties and their values.

0
P

@ToniHunter274

Posted

@Auddity thank you very much,I would check out AJAX and try to understand it.thank you for the tip.

0

Please log in to post a comment

Log in with GitHub
Discord logo

Join our Discord community

Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!

Join our Discord