View Full Version : Resolved Aborting an AJAX request

01-19-2011, 06:10 AM
Hey all, I am using this AJAX function to perform an action when it is called:

function xmlhttpPost(strURL, cword) {
var xmlHttpReq = false;
var self = this;
if (window.XMLHttpRequest) {
self.xmlHttpReq = new XMLHttpRequest();
} else if (window.ActiveXObject) {
self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
self.xmlHttpReq.open('POST', strURL, true);
self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
self.xmlHttpReq.onreadystatechange = function() {
if (self.xmlHttpReq.readyState == 4) {
This is working fine, however, I want any previous AJAX requests to be aborted before beginning the new AJAX request. I have searched, and I can't find anything specific to the current structure of the AJAX function I am using to get the job done.

What changes must I make in order to do this?