Homework 7 (Baby Names Redux) FAQ
-
Q: I'm lost. I don't really understand Ajax. What should I do?
-
A: Read the book Chapter 10, particularly the Chapter 10 case study. Look at the slides and programs from lecture, and the lab and section solutions.
-
Q: Why does my page load the list of names veeeeerrry slowly?
-
A: Use the DOM to add elements to the page. Don't just concatenate strings using
innerHTML
.
-
Q: Sometimes the height I compute for a bar is a decimal, like 123.45px . What should I do about this?
-
A: Round down by calling
parseInt
or Math.floor
.
-
Q: What happens with a 0 ranking?
-
A: As with any other ranking, it should be displayed.
-
Q: If I do the "loading message" feature, how fancy does our loading message have to be? Can it just show loading for 10 seconds and once 10 seconds have passed, show the graph and meaning?
-
A: You have to show some kind of image, animation, etc.
-
Q: How do I test an Ajax failure/error case to see what my code will do?
-
A: Just enter a bogus URL on webster for a page that doesn't really exist.
-
Q: How do I remove an existing element from the page?
-
A: Thanks to Prototype, for most elements you can say
$("elementID").remove();
But if you happen to be removing a select
element, you have to say Element.remove("elementID");
because select
elements already have their own remove
method that does something else.
-
Q: If I have displayed an error message on the screen, and the user selects another name, should the error stay on the screen or go away?
-
A: It should go away.
-
Q: After a little bit of time testing my page, it will stop running any Ajax requests. The request doesn't even show up in the NET tab in Firebug. It can be fixed by closing and reopening the window. Why is this happening?
-
A: It may be due to webster's security. Maybe your login cookie expires and it makes you log in again before any more Ajax requests will go through.