Hi Im having a **** difficult time with a ajax request. Basically i get the follow exception error on my firefox error console when I do an ajax request

Error: [Exception... "Component returned failure code: 0x80040111 (NS_ERROR_NOT_AVAILABLE) [nsIXMLHttpRequest.status]" nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)" location: "JS frame :: http://localhost/trainingTools/ajax1.js :: anonymous :: line 64" data: no]
Source File: http://localhost/trainingTools/ajax1.js
Line: 64


this is the ajax code that i created:

Code:
function course_sec_id()
{
 
    var courseRequest;  
   	try{
		// Opera 8.0+, Firefox, Safari
		courseRequest = new XMLHttpRequest();
	//	trainingRequest.overrideMimeType('text/xml');

	} catch (e){
		// Internet Explorer Browsers
		try{
			courseRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e2) {
			try{
				courseRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e3){
				// Something went wrong
				alert("Your browser is not compatible!");
				return false;
			
			}
		}
	}
   
   // alert('function start');
    //browser support code
	 // The variable that makes Ajax possible!
    //courseRequest = getHTTPObject();
	//alert('ajax object created');
	//object created
	
		// Create a function that will receive data sent from the server
	    courseRequest.onreadystatechange = function(){
	  //  alert('getting ready'); 
	    
	//  alert('current state: '+ courseRequest.readyState);
	
	//check http status.  If not 200 (OK) then throw the status error code
	if(courseRequest.readyState == 4)
	{   
		if((courseRequest.status != 200)||(courseRequest.statusText != 'OK')) 
		{
		    alert(courseRequest.statusText);
	    }
	    else
	    {
			alert('Please proceed!');
		}
	}
    };
        
          var securityID = document.getElementById('secid').value;
	    var course = document.getElementById('Name').value;
	    var cInst = document.getElementById('cIns').value;
     	var queryString = "secid=" + securityID + "&Name=" + course + "&cIns=" + cInst;
			courseRequest.open("POST", "courseSecIdUpdate.php",true);
			courseRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
			courseRequest.setRequestHeader("Content-length", queryString.length);
			courseRequest.setRequestHeader("Connection", "close");	
	
		courseRequest.send(queryString);
	    		    
}
Basically what happens is that when this code is triggered through the following html:
[/code]

<form action="trainingformSubmit.php" onsubmit="course_sec_id();"
name="trainingForm" method="post" id="trainingForm">

[/code]

The ajax function does not process when readystate is 4 ( I do not get any of the alert messages).

However, get this, if i add the highlighted line from above aajx code:

Code:
alert('get ready');
The whole process works..

This is really confusing. overall all of the code not work at all in safari. Works with exceptions in firefox, works well as it is in IE6,7.

PLEASE HELP!!! this is a BRAIN Killer!