I'm attempting to detect if the state of each td
element changes every 34 seconds.
How it currently works:
- I have a PHP page that converts an array of data into a table
- On the page that displays the table, I have a Js file connected that refreshes the div every 34 seconds
- On refresh I'm checking each
td
element if it has changed value, but it's not working
Here's what I've currently put together, but the background color isn't changing:
setInterval(function() {
$.ajax({
url: 'http://localhost:8888/profitmanager/wp-content/plugins/football-stats/update.php'
}).done(function(){
$('.fbs_results').load(location.href+" .fbs_results>*","");
$('.fbs_results table tr td').each(function(){
var td = $(this);
$(td).on("DOMSubtreeModified", function(){
$(td).css('background-color', 'yellow');
});
});
});
}, 34000);
I thought it might be down to event delegation, but then I wouldn't know how to action that into my current script.
Any ideas?
TIA