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

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

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

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

Recommended Answers

All 2 Replies

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

setInterval("sendRequest()", 2000 );

thanks a lottttt.!!!!Its working Great ..!!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.