Problem with jquery .get ( Only update div when changed )
Hi Guys,
I have the following code.
I have the following code.
I have a div named data that gets filled in by the data from data.php
How can i get it so it ONLY updates that div when the data is different as currently it doesnt.
It seems to update even though its the same ( If i have something selected in teh div, it will de-select when it updates ( although the html is the same ))
Thanks in advance.
Code:
<script language="javascript" type="text/javascript">
<!--
function getdata() {
$(document).ready(function(){
$.get("data.php", function(result){
if(result != $("#data").html())
{
$("#data").html(result);
}
});
});
}
//-->
var timer = null;
timer = setInterval('getdata()', 2000);
</script>
View full post on Tycoon Talk
.get, Changed, jquery, only, Problem, update