i made this:
<script type="text/javascript">
$('.storage').html("");
setInterval(function(){
$.get('./playcommand.php', function(data) {
if($('.storage').html() !== data){
$('.result').html(data);
console.log("neu");
}
});
}, 500); // 5 seconds
</script>
My Intention is to console.log("neu");
only if data from AJAX is different than the data before, thats why i created a div "storage" where i save the latest data which was not equal to the data before.
But it doesnt works, it logs always "neu", even if the data isnt different.
UPDATE:
My new Code:
<script type="text/javascript">
var storage = $('.storage').text();
setInterval(function(){
$.get('./playcommand.php', function(data) {
if($('.storage').text != data){
$('.result').html(data);
console.log("neu");
}
});
}, 500); // 5 seconds
</script>
Still doesnt work