Problem with javascript code in Mozilla firefox.

//Initial Code block
PhaseID = cboPPPhase.options[cboPPPhase.selectedIndex].value;
WorkflowRequest(PhaseID);

//The function
function WorkflowRequest(PhaseID)
{	
             //This is Ajax code block
	Http.get({url: "../ajax/Process.aspx?PhaseID=" + PhaseID , asynchronous:false, callback: WorkflowRequest_callback});
}

//The callback function
function WorkflowRequest_callback(Result)
{
             if (Result.readyState==4)
	{
	             if (Result.status==200)// if "OK"
		{
			WorkflowProcessResult(Result);
		}
	}
}

The problem here is that after calling the ajax code i cannot able to call the callback function (WorkflowRequest_callback(Result). The debugger does not come to the call back function.

This occurs in Mozilla browser and works perfectly in IE.

//some part of Ajax code is as below:
get: function(params, callback_args){	
		if (!Http.enabled){
			//alert("Http: XmlHttpRequest not available.");
			return null;
		}
		
		var url = params.url;
		if (!url)
		{
			//alert("Http: A URL must be specified");
			return null;
		}
				
		var method = params.method || Http.Method.Get;
		var callback = params.callback;
		var async = params.asynchronous;
		//alert(async);
		if (async == undefined)
			async = Http.Asynchronous;

		//alert('method : ' + method + "\n\n" + 'url : ' + url + "\n\n" + 'async : ' + async)
				
		//alert(async);
			
		var sep = (-1 < url.indexOf("?")) ? "&" : "?"	
		url =  url + sep + "__=" + encodeURIComponent((new Date()).getTime());
	
		// Only one request at a time, please
		if ((Http._get.readyState != Http.ReadyState.Uninitialized) && 
			(Http._get.readyState != Http.ReadyState.Complete)){
			this._get.abort();
		}
		alert(method +" Url "+ url+" Async "+ async);
		Http._get.open(method, url, async);
		
		
		
		Http._get.onreadystatechange =  function() {
			if (Http._get.readyState != Http.ReadyState.Complete) return;
			
			if (callback_args == null) callback_args = new Array();

			var cb_params = new Array();
			cb_params.push(Http._get);
			for(var i=0;i<callback_args.length;i++)
				cb_params.push(callback_args[i]);
			
			if ( callback!=null)	
			 callback.apply(null, cb_params);
		}		//alert(params.body);
		Http._get.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		//if (params.body)
		//	Http._get.setRequestHeader("Content-length", params.body.length);
		//Http._get.setRequestHeader("Connection", "close");
		//if (params.body)
		//alert(params.body);
		Http._get.send(params.body || null);
		
	}
	
}

I think the error is somewhere here in the Ajax code coloured red.

In IE the Ajax code executes peoperly but in Mozilla the code doesnot execute.

Any suggestions are welcome !!!

Have u tried using firebug?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.