I've made some progress...
So in testing if the database value has changed, the only way that I can think of doing it would be to put in a timestamp into the database each time it changes and then in my hasChanged.php I can simply test if the time since the last timestamp is less than x; then return 1 or 0.
Does anyone have any other ideas? I sort of wanted to stay away from the timestamp, because I will be checking a database change every 2 seconds, and if for some reason a user takes longer than 2 seconds, they won't get an update.
I attempted to do it via a session variable, but the main page does not update the session variable in the javascript each time it queries hasChanged.php (since the page is not reloading).