Git Product home page Git Product logo

have-samuel / ajax-apis Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 53 KB

Use JavaScript to fetch and send data to and from the web, leveraging a set of web technologies called AJAX and focusing on the AJ part of AJAX - Asynchronous JavaScript. then learn what asynchronous code is and how to manage it with the newer features. Learn about async functions, and finally, use JavaScript to make HTTP requests with AJAX.

License: MIT License

JavaScript 33.66% HTML 30.23% CSS 36.11%
ajax-request api axios js

ajax-apis's Introduction

AJAX Giphy Party

ajax-giphy-party-exerrcise-starter.zip

It’s time to build something fun with your knowledge of axios and AJAX! For this exercise we will be using the Giphy API! This will require you to use an API key and understand some of the documentation about the API.

The Application

Your application should do the following:

  • Allow the user to search for a GIF and when the form is submitted, make an AJAX request to the Giphy API and return a single GIF
  • Once the Giphy API has responded with data, append the GIF to the page
  • Allow the user to search for as many GIFs as they would like and keep appending them to the page
  • Allow the user to remove all of the GIFs by clicking a button
  • Here is an example of what the application might look like

long gif size… could take few seconds to load on your page

Part 1: Building the Form

We’ve provided a starter HTML file, but there’s next to nothing in the body. Start by building a simple form with an input for a search term and a submit button. When the user submits the form, use axios to make a request to GIPHY for information based on that term. After receiving the response, console.log the response data to make sure you’re getting back what you expect.

For example, here is what the AJAX request URL would look like for search term of “hilarious”: http://api.giphy.com/v1/gifs/search?q=hilarious&api_key=MhAodEJIJxQMxW9XqxKjyXfNYdLoOIym. You can click on this URL and see the JSON you will get back. To view this in a nicer format, we highly recommend using the JSON Viewer chrome extension. This is also the data you should console.log when the form is submitted.

Part 2: Appending GIFs

Now that you’re communicating properly with the API, you should do something more interesting with the response data. Instead of logging it, grab a GIF from the response data and append the GIF to the page. Ensure that if you submit the form multiple times, you’ll get multiple GIFs showing up.

Part 3: Removing GIFs

Add a button next to the form which, when clicked, will remove all GIFs from the page.

ajax-apis's People

Contributors

have-samuel avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.