Giter Site home page Giter Site logo

js-ajax-callbacks-lab-web-0616's Introduction

Ajax Lab

Objectives

  • Use Ajax get method
  • Use success callback
  • Use error callback
  • Read API documentation
  • Use Handlebars templates to render responses.

Introduction

Let's our new Ajax skills to work by making a Github repository search client. This lab will test your ability to use jQuery's $.get function with callbacks, and give you some more practice reading API documentation.

We're also going to practice using Handlebars templates with Ajax, and bringing these tools altogether to create a dynamic application.

All of the HTML and javascript files have been provided. The file index.html has a basic two column structure, and you'll add your JavaScript code to script.js. There are also tests, so don't forget to run them, and load your page up in the browser to make sure everything's working!

Instructions

We're making a Github repository search client. It should take a user's search terms, query the Github search API for repositories, and display the results in the left-hand column. The user can then click various links in each repository to get more detailed information in the right-hand column.

  1. Create a "Search Repositories" link that calls a searchRepositories function on click, takes the value of a searchTerms text input and queries the Github repository search API.
  2. Display the collection of repositories inside the results div. Include repository name, description, and a link to the html url. Also include repository owner login, repository owner avatar as an image, and a link to the owner's profile page. Hint: Pay close attention to the structure of the search results!
  3. Add a "Show Commits" link to each repository result that will call a showCommits function that gets the repository's commitss from the Github API and display them in the details div. For each commit, list the SHA, the author, the author's login, and the author's avatar as an image.
  4. Handle errors on each API call. If $.get fails, call a function displayError and display "I'm sorry, there's been an error. Please try again." in the errors div. Hint: You can test your error callbacks by turning off wi-fi or temporarily changing the URL you use in the $.get request.
  5. Use Handlebars templates to render your results instead of building your HTML in your JavaScript functions. Extract the user data sections into a partial called userDetails that can be reused for both the repository results and the commits. Register the partial in the provided handlebarsSetup function.

Resources

js-ajax-callbacks-lab-web-0616's People

Contributors

cbdileo avatar victhevenot avatar pletcher avatar scottcreynolds avatar mendelb avatar

Watchers

James Cloos 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.