jquery update label specific intervalshttp://forums.asp.net/t/1793015.aspx/1?jquery+update+label+specific+intervalsSun, 15 Apr 2012 17:45:49 -040017930154933010http://forums.asp.net/p/1793015/4933010.aspx/1?jquery+update+label+specific+intervalsjquery update label specific intervals <p>Hi,</p> <p>I have a label and i need to update the value of that label automatically every x minutes</p> <p>i have the following code which uses jquery but it loads another page</p> <p>i just need to get the result a function in my asp.net file and display it on that label</p> <p>what should i do?</p> <p><br> &lt;script src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js&quot;&gt;&lt;/script&gt;<br> function update() {<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#36;('#container').load('test.aspx');<br> &nbsp;&nbsp;&nbsp; }<br> &nbsp;&nbsp;&nbsp; setInterval(&quot;update()&quot;, 10000);</p> <p>&lt;div id='container'&gt;&lt;/div&gt;</p> 2012-04-15T10:08:01-04:004933257http://forums.asp.net/p/1793015/4933257.aspx/1?Re+jquery+update+label+specific+intervalsRe: jquery update label specific intervals <p>Here is the server code:</p> <pre class="prettyprint">[WebMethod] public static String GetData(String X) { return X &#43; &quot; &quot; &#43; DateTime.Now.ToLongTimeString(); }</pre> <p>Here is the client code:</p> <pre class="prettyprint">function update() { &#36;.ajax({ type: "POST", url: "Default.aspx/GetData", data: "{X: 'Hello:'}", contentType: "application/json; charset=utf-8", dataType: "json", success: function (msg) { &#36;('#container').text(msg.d); }, error: function (msg) { &#36;('#container').text(msg.statusText); } }); } setInterval("update()", 10000); </pre> <p>Here are details:</p> <p><a href="http://encosia.com/using-jquery-to-directly-call-aspnet-ajax-page-methods/">http://encosia.com/using-jquery-to-directly-call-aspnet-ajax-page-methods/</a><br> <br> <br> </p> 2012-04-15T14:52:07-04:004933369http://forums.asp.net/p/1793015/4933369.aspx/1?Re+jquery+update+label+specific+intervalsRe: jquery update label specific intervals <p>Thanks</p> <p>another question</p> <p>how can i output the function as html? to show for example a div</p> <p>like return &quot;&lt;div&gt;&quot; &amp; ....</p> <p>but it return just the text</p> <p></p> 2012-04-15T17:32:59-04:004933377http://forums.asp.net/p/1793015/4933377.aspx/1?Re+jquery+update+label+specific+intervalsRe: jquery update label specific intervals <p>If you have another question, start another thread.</p> 2012-04-15T17:45:49-04:00