I load the table, which is taken from the БД mysql in the file table.php

 var seconds = 1; var divid = "responsecontainer"; var url = "table.php"; function refreshdiv() { var xmlHttp; try { xmlHttp = new XMLHttpRequest(); // Для нормальных браузеров } catch (e) { try { xmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); // .... } catch (e) { try { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { alert("Твой браузер не поддерживает AJAX."); return false; } } } xmlHttp.onreadystatechange = function() { if (xmlHttp.readyState == 4) { document.getElementById(divid).innerHTML = xmlHttp.responseText; setTimeout('refreshdiv()', seconds * 1000); } } xmlHttp.open("GET", url, true); xmlHttp.send(null); } 

The problem is that I just can’t hang an alert reacts to changes (adding a new line, deleting the old one, etc ) in a div-e with the id responsecontainer . How to do this, tried this script:

 $('responsecontainer').bind("DOMSubtreeModified",function(){ alert('changed'); }); 

But he reacted to everything.

  • one
    That is why it is necessary to transfer data on the basis of which to build markup, and not just markup, and try to understand what data was on it - Grundy
  • he reacted to everything - because in the string document.getElementById(divid).innerHTML = xmlHttp.responseText; you change everything - Grundy

0