I am using AJAX to load content from a PHP file into a div every 5 seconds. This works fine, but I would like to refresh the browser if the contents of the div are equal to "Your item has expired."
Here is my HTML:
<div id="tableHolder"></div>
Here is my JS:
$(document).ready(function(){
refreshTable();
});
function refreshTable(){
$('#tableHolder').load('ajax_time.php', function(){
setTimeout(refreshTable, 5000);
});
}
I think I can use something like:
if (document.getElementById('tableHolder').innerHTML == "Your item has expired.")
But I'm not sure how to go about putting it together. Any ideas?