Instructions

The goal of this project is to give you experience using AJAX. Recall that AJAX stands for Asynchronous JavaScript and XML. However, it really just means sending data back and fourth between a client and server without refreshing the page. JSON is a more typical format for data communication than XML, though any kind of data can be sent back and forth (binary, text, whatever).

For this assignment, you will convert MP5 (user login) into two separate components: an HTML page called mp7.html and a PHP script called mp7.php. Your HTML should display the possible views (login form vs. signout button) based on whether the user is logged in or not. However, both panes should be present on the same HTML page. Use JavaScript to only show the appropriate pane, which should be decided by making AJAX calls to mp7.php. That means mp7.php needs to return information saying whether or not the user is logged in, and whether or not an error was encountered.

Note that jQuery makes hiding elements easy, e.g.,

To see an example of how to make AJAX calls, look at your MP6 HTML, or this example.

See the jQuery AJAX documentation and Learning Center for more information on how to use it.

Submission

Your files should be located on Joust in the directory ~/public_html/csc401/mp7/, in addition to being uploaded to Canvas. The rubric can be found here. The Canvas submission page is here.

(Back to top)