title: how to cancel http request using javascript
body: <p>i have a page on which there an event handler attached to an <code>onclick</code> event. when the event fires it passes contents of a textbox to a <code>GET</code> request. since <strong>the url is not in the same domain</strong> so i create a script tag and and attach the url to its source like this </p>
  
  <pre><code>elem.onclick=fire;
  
  function fire()
  {
  var text=document.getElementById('text').value;
  var script=document.createElement("script");
  script.className="temp";
  script.src="some url"+"?param="+text;
  document.body.appendChild(script);
  }
  </code></pre>
  
  <p>now if that event is fired and more than one time i want to cancel all the previous <code>GET</code> request(because they still might be receiving response) and make the <code>GET</code> request with latest text. But for this i need to cancel the previous requests. 
  i tried </p>
  
  <pre><code>document.body.removeChild(script);
  script.src=null;
  </code></pre>
  
  <p><strong>but this does not work in <code>Firefox</code>(i am using <code>Firefox 5</code>) although this works in <code>Google Chrome</code></strong>.Does anyone know if these requests can be cancelled in Firefox and if yes then how?</p>
  
  <hr>
  
  <p><strong>UPDATE</strong>
  As suggested by Alfred, i used <code>window.stop</code> to cancel a request but does not cancel a request but hangs it up. It means that when i look into firebug it looks like the request is being made but there is no response.</p>