lynxus Posted October 16, 2011 Share Posted October 16, 2011 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. <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> Quote Link to comment Share on other sites More sharing options...
lynxus Posted October 16, 2011 Author Share Posted October 16, 2011 Anyone? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.