I would like to call setinterval, and when set interval completes, change the page
<p>I would like to use set interval, and when interval completes, change page - however, with this below, it changes the page after 1 interval run when I want to to change page when myNumber >= 300.</p>

<p>I'd be grateful of any help, thanks</p>

<pre><code>    var myNumber = 0;

function openportal() {

    var myInterval = window.setInterval(myzoom,2);
        document.location.href ="http://next page";

}

function myzoom () {

      if(myNumber&gt;=300){
          clearInterval(myInterval);
      }
      myNumber++;

}
</code></pre>
