I have a page on which an event handler is attached to an onclick event. when the event fires, it passes the contents of the text field to the GET request. since the url is not in the same domain , so i create a script tag and attach the url to its source like this
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); }
now if this event is fired and more than once I want to cancel all previous GET requests (since they can still receive a response) and make the GET request the last text. But for this I need to cancel the previous requests. I tried
document.body.removeChild(script); script.src=null;
but it doesnβt work in Firefox (I use Firefox 5 ), although it works in Google Chrome . Does anyone know if these requests can be canceled in Firefox, and if so, how?
UPDATE As suggested by Alfred, I used window.stop to cancel the request, but did not cancel the request, but hung. This means that when I look in firebug, it looks like the request is being executed, but there is no answer.
lovesh
source share