Problem with jquery .get ( Only update div when changed )

Hi Guys,
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

, , , , ,

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Get Adobe Flash playerPlugin by wpburn.com wordpress themes


RSS Site FeedRSS Site Feed

© 1992-2011 DC2NET™, Inc. All Rights Reserved