There's a good introductory AJAX tutorial on MDN. To handle the ajax request, you're going to have to create a script (or change the current script, to determine if the request is via AJAX and respond accordingly) that *only* queries the database, compares the times, and returns the result.

