0

I am trying to call a function repeatedly after a certain amount of time delay with the help of java script.

<html>
<head>
<script type="text/javascript" src="prototype.js"></script>
		<script>

			function sendRequest() 
                        {
				Something to do
			}
		</script>
</head>
<body>
<script type="text/javascript">
 setTimeout ( "sendRequest()", 2000 );
</script>
</body>
</html>

If i use any infinite for loop before line 14 then my browser giving warning...!!
What to do??

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by debasishgang7
1

Use setInterval() method instead of setTimeout(). setInterval will repeatedly call a function at given interval

setInterval("sendRequest()", 2000 );
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.