ASP.NET
Source Code
Home > Source Code >ASP.NET > Controls
 
  Timed Ajax Calls With JQuery And ASP.NET  
 
 
  1. <head runat="server">

  2.     <title>Untitled Page</title>

  3. </head>

  4. <script src="jquery.js" type="text/javascript"></script>

  5. <script type="text/javascript">

  6. $(document).ready(function() {

  7.      setTimeout(MyUpdate,10 * 1000);

  8. });

  9.  

  10.  

  11.    

  12. function MyUpdate()

  13. {

  14.     $.get("ajaxdata.ashx",function(result)

  15.         {

  16.             if ( $('#lblMinute').text() != result )

  17.             {

  18.                 $('#lblMinute').html(result);

  19.                 $('#lblMinute').fadeOut(450);

  20.                 $('#lblMinute').fadeIn(450);

  21.                 $('#lblMinute').fadeOut(450);

  22.                 $('#lblMinute').fadeIn(450);

  23.                 $('#lblMinute').fadeOut(450);

  24.                 $('#lblMinute').fadeIn(450);

  25.             }

  26.         });

  27.     setTimeout(MyUpdate,10 * 1000);

  28.  }

  29. </script>

  30. <body>

  31.     <form id="form1" runat="server">

  32.     <div>

  33.     <span style="background-color:LightBlue" >Autoupdating every 10 seconds...</span>

  34.     <table border="1">

  35.     <tr>

  36.     <td>Something</td>

  37.     <td><asp:Label ID="lblDataUpdated" runat="server">Hello there bla bla</asp:Label></td>

  38.     </tr>

  39.     <tr>

  40.     <td>Other important stuff</td>

  41.     <td>Again more bla bla</td>

  42.     </tr>

  43.     <tr>

  44.     <td>Current minute is</td>

  45.     <td><asp:Label ID="lblMinute" runat="server"></asp:Label></td>

  46.     </tr>

  47.  
 
 
Date entered : 20th Apr 2007
Rating : No Rating
Accessed : 1946
Submitted by : ahmedraza
 
0 comments have been posted for this Source Code.View Comments Here
 
Home > Source Code >ASP.NET > Controls
Copyright Visualbuilder.com 1999-2006