Watch this short screencast to see our AM1 application in action. Scroll down the page to press the play button.
In the first two weeks we will work together in class and outside to complete this first milestone. The app shown in the screencast uses one Web API (which one?), code written in Javascript to access the data from the API and to dynamically show it in the page, some CSS to style the page, as well as HTML (the page that we see at the beginning). Our goal would be to learn how this app was built, so that you can create a new (very similar) app that uses a different API to display something else on the page (maybe movie reviews from Rotten Tomatoes or recipes from Yummly, the choice is yours).
Your task in the next days will be to figure out how this app was built, what "ingredients" it uses and where they come from, and what you'll need to learn to be able to implement it on your own (either alone or working with a peer). Below is a group of questions that might help you in your discovery and learning process. If you have no familiarity with Javascript, you can start with the second part, where you make up your own data and then show them in the page with static HTML and CSS.
As you might have noticed toward the end of the screencast, where the HTML source code of the page is shown, there are no data that show up in that page. This is because we cannot know in advance what books should be displayed in response to the query. The data will come from somewhere else (external to our webpage).
var results =
to store them. Save the file as a JS file. Do you know how
you can refer to this file from a simple HTML page?results
in the console. Now, try to
access the title and description of a book.for
loop to go through the books and show all titles?When you have finished these steps, you might be ready to start writing the application. Initially you'll write a static application, with the data from the locally stored results. Once your page looks more or like as the screencast, you can continue writing a function that will create a new URL request on the fly to get data for a new search phrase. Then, this data will be displayed in the page, using the same function you wrote to display the locally stored data.
You can complete the following steps, even if you don't have started or completed the above steps about the data.
div
to keep all elements of a book together.Remember to keep your CSS rules in a separate file, which is referred to in the HTML page with the
link
tag. Class attributes that you use in the HTML should match selector names in
the CSS file. You might need to use some nested containers to achieve certain effects in the page.
Once you have completed the book search app, you'll create a new app (very similar to this) which uses a different web API. You will be able to reuse most of the code you wrote for the book search app, but there will be some differences too.
Here is a list of some of the APIs that you can use to create a search page. Most of these APIs will require you to sign up for an API key to use with your app.
Here are instructions for how to submit your work.
public_html
folder, create a cs249
folder where
you will upload all your work during the semester. In the cs249
folder
you'll put an index.html
file that will have links to your code. Here
is a suggestion for what to put in the file (feel free to style it the way you like it)
cs249
, you will have a folder AM1
, where you'll put
all files you created for this AM1.books.html
from the index.html
file (see above point)./* Filename: am1.js Author: Wendy Wellesley Date: Feb 6, 2015 Goal: Javascript code for implementing a wep app that searches the ABC API for Y, and displays the results dynamically in a web page. Honor Code Statement: On this task I collaborated with Harry Potter and Hermione Granger. I had difficulty with the XXX issue, but Hermione gave me a good example to understand it. All the code in these files was typed by me. */
There are 10 points for this assignment, which are divided as follows:
books.html
(no need to look like the screencast)am1.html
. This app uses one of the APIs
listed above, can be searched through the input box for different queries, and displays the results
in a meaningful way.