Javascript - Jquery .load() and setInterval() issue
<p>Let's say I do this:</p>

<pre><code>$("#content").load(...);
</code></pre>

<p>Within what I'm loading some javascript is included:</p>

<pre><code>var myCounter = 0;
var myInterval = setInterval(function(){
   myCounter++;

   $("#counter-display").html("Count: "+myCounter);
});
</code></pre>

<p>For an unknown reason, if I reload the content with $("#content").load(...); - myInterval is now being called twice.</p>

<p>I tried doing something like:</p>

<pre><code>if (myInterval !== undefined){
   //dont set interval again
}
</code></pre>

<p>However, it doesn't work. Does anyone know any method so that myInterval is cleared on .load, without needing to put the javascript outside of the loaded file?</p>
