Site Search

CS 352: Lab 4 - Ajax, PHP, and Prototype

Student Learning Objectives

After completing Lab Assignment 4, students should be able to

Lab 4 Pair Programming Teams

Team 1Team 2Team 3Team 4Team 5
LiamBrockSamwiseTomPaul
KevinBenGeneTrevorGary

You may wish to review the basic pair programming guidelines before you begin.

You should change roles with each iteration

Lab 4 Assignment

This lab is based on the steps provided in the Guide to Using AJAX and XMLHttpRequest from WebPasties tutorial.

However, rather than just following the instructions and coding the JavaScript and XMLHttpRequest directly, use calls to Prototype methods to simplify development and generate cross-browser code.

Note: If you did not do this on Day 17, download prototype.js and save the file in your u:\htdocs folder

Iteration 1

Lab 4 will be done with HTML-Kit text editor and the localhost Abyss web server

  1. Create a U:\htdocs\Lab4 folder to hold the files associated with today's lab
  2. Create a XHTML strict page named index.html saved in your Lab4 folder
  3. Do Step #1 - Creating the Form from Guide to Using AJAX and XMLHttpRequest tutorial
    • Fix the tutorial's code to add labels for textboxes
    • Validate your page to XHTML strict standards in HTML-Kit
  4. Do Step #2 - Adding the Event Handler
    • Register the blur event using prototype's Event.observe method, do not register the event in the HTML form's code
  5. Do Step #3 and Step #4 - Some Instant Gratification
    • This part will be simplified by using Prototype's Ajax.Request method
    • Create Lab4.php to echo "Buzzard Puckey, NM" to test your Ajax call

Functional Tests

Iteration 2

Before beginning these Iteration 2, switch roles between driver and navigator.

zipcodes Table
zipcode city state
98001 Auburn WA
98002 Auburn WA
98003 Federal Way WA
98004 Bellevue WA
... ... ...
  1. Step #5 Creating the ZIP code database is done for you - download the lab4.sqlite database and save it in your Lab4 folder
  2. Do Step #6 - Querying the ZIP database

Functional Tests

Iteration 3

Before beginning these Iteration 3, switch roles between driver and navigator.

  1. Do Step #8 What about the XML
    • You will need to rewrite the function showResponse(r) to access r.responseXML

Functional Tests

To Receive Credit

Lab 4 is due by the start of class on Monday