application after being published stops updating the update panel after few minutes

72 views Asked by At

This is the code which updates my updatepanel regularly, it runs very well on local for a long period of time but after being published, it works good for 15-20 minutes , may be lesser sometimes. but after that it does not update the contents inside updatepanel automatically, but on a button click it updates the updatepanel with new data. I suggest it might be the case of outputcache. What is the problem?

 <script type="text/javascript" language="javascript">
       setInterval(function () {

           __doPostBack('updateComments', '');
           // document.getElementById("btnExitChatRoom").click();
       }, 5000);

   </script>
1

There are 1 answers

1
Pawan Sinha On

You need to call 'setInterval' on document ready. Below is the example:-

<script type="text/javascript">     
  $(document).ready(    
    function ()
    {          
         setInterval('myFun()', 5000);      
    });
    function myFun() 
    {         
         __doPostBack('updateComments', '');     
    } 
</script>