<script type="text/javascript">var timer ; $(document).ready(function () { var i = 1; timer = setInterval(function() { alert(i++) }, 2000); }); </script>