Giter Club home page Giter Club logo

06-ajax-and-json-and-wrrc's Introduction

CF Lab 06: jQuery AJAX & JSON

Lab 06 Submission Instructions

Follow the submission instructions from Lab 01.

Resources

Ternary Operator MDN

Configuration

Your repository must include:

06-ajax-and-json-and-wrrc
└── starter-code
└── driver-navigator
  ├── .eslintrc.json
  ├── .gitignore
  ├── LICENSE
  ├── data
  │   └── hackerIpsum.json
  ├── index.html
  ├── new.html
  ├── scripts
  │   ├── article.js
  │   └── articleView.js
  ├── styles
  │   ├── base.css
  │   ├── layout.css
  │   └── modules.css
  └── vendor
      ├── scripts
      │   └── highlight.pack.js
      └── styles
          ├── fonts
          │   ├── icomoon.eot
          │   ├── icomoon.svg
          │   ├── icomoon.ttf
          │   └── icomoon.woff
          ├── default.css
          ├── icons.css
          ├── normalize.css
          └── railscasts.css
    └── PULL_REQUEST_TEMPLATE.md
    └── README.md

User Stories and Feature Tasks

As a user, I want to be able to load my articles from an external source so that I do not need to keep all of the articles on my local machine.

  • Note: We are using a local JSON file as an emulation of a remote data source that provides JSON.
  • Fill in what's needed in article.js, so that all the articles are retrieved with AJAX, then loaded and rendered.
    • We only need to request the JSON file when we don't already have it, so the conditional check should only execute the AJAX call when local storage doesn't have the rawData yet.
    • Complete the else portion of the conditional to load the articles if they do not exist in local storage and cache them for next time. Include a comment which explains how you and your partner determined the sequence of code execution.
    • Make sure to pass in the correct argument to Article.loadAll() and render the index page.
  • In index.html, call the appropriate method to kick off the retrieval of data and render the page. Include a comment that explains what this function is doing.

As a developer, I want to understand the order of execution of my code so that I can better understand its functionality and optimize its efficiency and maintainability.

  • Start by looking over what's new in the codebase. There is a /data folder!
  • Make sure to look at all of the // REVIEW statements. Practice your code-reading skills.
  • There are some // COMMENT tasks that focus on the sequence of code execution, so be attentive to that as you read through the code.

Stretch Goals

As a user, I want to be able to request a new copy of my JSON file whenever it is changed so my app is always up-to-date.

  • Coded as above, we won't request a new JSON file if we've already downloaded it once. This caching is problematic: if the JSON file is updated (therefore our cache is "invalid"), a new copy won't be requested from the server unless local storage is cleared. To overcome this, we could use a small and fast AJAX request with a type of HEAD, to request just the headers, and not the contents of the file. The HEAD response will contain a key called "eTag". The value of the eTag header is calculated based on the contents of the file. So if a new article is added (or an existing one is edited even slightly), the eTag will be different.
    • If we cache the eTag, then we can compare our cached version of it with a new eTag check, to determine if we need to get the whole file or not.
    • This can introduce some synchronicity issues, so we'll need to carefully control what methods are calling back to what.

Hint: You'll be able to see everything the server returns, if your AJAX success function looks something like this:

function(data, message, xhr) {
  console.log(xhr);
}

Documentation

Your README.md must include:

# Project Name

**Author**: Your Name Goes Here
**Version**: 1.0.0 (increment the patch/fix version number up if you make more commits past your first submission)

## Overview
<!-- Provide a high level overview of what this application is and why you are building it, beyond the fact that it's an assignment for a Code Fellows 301 class. (i.e. What's your problem domain?) -->

## Getting Started
<!-- What are the steps that a user must take in order to build this app on their own machine and get it running? -->

## Architecture
<!-- Provide a detailed description of the application design. What technologies (languages, libraries, etc) you're using, and any other relevant design information. -->

## Change Log
<!-- Use this are to document the iterative changes made to your application as each feature is successfully implemented. Use time stamps. Here's an examples:

01-01-2001 4:59pm - Application now has a fully-functional express server, with GET and POST routes for the book resource.

## Credits and Collaborations
<!-- Give credit (and a link) to other people or resources that helped you build this application. -->
-->

06-ajax-and-json-and-wrrc's People

Contributors

mnfmnfm avatar

Watchers

 avatar  avatar  avatar  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.