I have the code below that doesn't seem to work at all :( I keep getting:
Microsoft JScript runtime error: Object expected
An error occurs when the timeout is completed. Therefore, if I raise the timeout with 10 seconds, the error will continue for another 10 seconds.
I want to be able to update the number of friends on the Internet. The number is displayed with the following html:
<a href="" id="showChat" >Friends online <strong id="friendsOnline">(?)</strong></a>
Some friends are established at the first start, but when the timeout calls back, it does not start again. Also, I donβt see which line the error occurs on, because if I want to break the error, it just shows βno source codeβ, etc.
Below is the code I'm using. Thanks!
<script src="http://ajax.microsoft.com/ajax/jquery/jquery-1.3.2.js" type="text/javascript"></script> <script src='/Scripts/MicrosoftAjax.js' type="text/javascript"></script> <script src='/Scripts/MicrosoftMvcAjax.js' type="text/javascript"></script> <script src='/Scripts/jquery.autocomplete.js' type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function() { UpdateFriendsOnline(); function UpdateFriendsOnline() { window.setTimeout("UpdateFriendsOnline()", 1000); $.get("/Account/GetFriendsOnline", function(data) { $("#friendsOnline").html("(" + data + ")"); }); } }); </script>
javascript jquery c #
Oskar Kjellin
source share