XMLHttpRequest Object Has An Abort() Method

// This will load the given file into the PRE element.
function ShowFile( strPath ){
 
	// Check to see if there is an AJAX request already in
	// progress that needs to be stopped.
	if (objHttpFileDataRequest){
 
		// Abort the AJAX request.
		objHttpFileDataRequest.abort();
 
	}
 
	// Use AJAX to get the text of the file and store the
	// new AJAX request object into the global variable.
	objHttpFileDataRequest = $.get(
		"index.cfm",
		{
			getdata: 1,
			file: encodeURI( strPath )
		},
		function( strFileData ){
			$( "pre#fileoutput" ).text( strFileData );
		}
		);
 
}
 
 
// Store a global value to the HTTP request object that is
// going to be used in our AJAX file data calls. In order
// to make sure that calls are not jumbled, we want to
// serialize our requests. Meaning, if one request goes out,
// it should abort any previously running request.
var objHttpFileDataRequest = null;

For Cut-and-Paste