rem: this.call = function(sFunction, aArgs, sRequestType) { var i,r,postData; if (document.body && xajaxWaitCursor) document.body.style.cursor = 'wait'; if (xajaxStatusMessages == true) window.status = 'Sending Request...'; if (xajaxDebug) this.DebugMessage("Starting xajax..."); if (sRequestType == null) { var xajaxRequestType = xajaxDefinedPost; } else { var xajaxRequestType = sRequestType; } var uri = xajaxRequestUri; var value; switch(xajaxRequestType) { case xajaxDefinedGet:{ var uriGet = uri.indexOf("?")==-1?"?xajax="+encodeURIComponent(sFunction):"&xajax="+encodeURIComponent(sFunction); if (aArgs) { for (i = 0; i<aArgs.length; i++) { value = aArgs[i]; if (typeof(value)=="object") value = this.objectToXML(value); uriGet += "&xajaxargs[]="+encodeURIComponent(value); } } uriGet += "&xajaxr=" + new Date().getTime(); uri += uriGet; postData = null; } break; case xajaxDefinedPost:{ postData = "xajax="+encodeURIComponent(sFunction); postData += "&xajaxr="+new Date().getTime(); if (aArgs) { for (i = 0; i <aArgs.length; i++) { value = aArgs[i]; if (typeof(value)=="object") value = this.objectToXML(value); postData = postData+"&xajaxargs[]="+encodeURIComponent(value); } } } break; default: alert("Illegal request type: " + xajaxRequestType); return false; break; } r = this.getRequestObject(); if (!r) return false; r.open(xajaxRequestType==xajaxDefinedGet?"GET":"POST", uri, true); if (xajaxRequestType == xajaxDefinedPost) { try { r.setRequestHeader("Method", "POST " + uri + " HTTP/1.1"); r.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); } catch(e) { alert("Your browser does not appear to  support asynchronous requests using POST."); return false; } } r.onreadystatechange = function() { if (r.readyState != 4) return;  if (r.status==200) { if (xajaxDebug && r.responseText.length < 1000) xajax.DebugMessage("Received:\n" + r.responseText); else if (xajaxDebug) xajax.DebugMessage("Received:\n" + r.responseText.substr(0,1000)+"...\n[long response]\n...</xajax>"); if (r.responseXML) xajax.processResponse(r.responseXML); else { alert("Error: the XML response that was returned from the server is invalid."); document.body.style.cursor = 'default'; if (xajaxStatusMessages == true) window.status = 'Invalid XML response error'; } }  delete r; } if (xajaxDebug) this.DebugMessage("Calling "+sFunction +" uri="+uri+" (post:"+ postData +")"); r.send(postData); if (xajaxStatusMessages == true) window.status = 'Waiting for data...'; delete r; return true; } 
add: this.call=function(sFunction,aArgs,sRequestType){var i,r,postData;if(document.body&&xajaxWaitCursor) document.body.style.cursor='wait';if(xajaxStatusMessages==true)window.status='Sending Request...';if(xajaxDebug)this.DebugMessage("Starting xajax...");if(sRequestType==null){var xajaxRequestType=xajaxDefinedPost;} else{var xajaxRequestType=sRequestType;} var uri=xajaxRequestUri;var value;switch(xajaxRequestType){case xajaxDefinedGet:{var uriGet=uri.indexOf("?")==-1?"?xajax="+encodeURIComponent(sFunction):"&xajax="+encodeURIComponent(sFunction);if(aArgs){for(i=0;i<aArgs.length;i++){value=aArgs[i];if(typeof(value)=="object") value=this.objectToXML(value);uriGet+="&xajaxargs[]="+encodeURIComponent(value);} } uriGet+="&xajaxr="+new Date().getTime();uri+=uriGet;postData=null;}break;case xajaxDefinedPost:{postData="xajax="+encodeURIComponent(sFunction);postData+="&xajaxr="+new Date().getTime();if(aArgs){for(i=0;i <aArgs.length;i++){value=aArgs[i];if(typeof(value)=="object") value=this.objectToXML(value);postData=postData+"&xajaxargs[]="+encodeURIComponent(value);} } }break;default: alert("Illegal request type: "+xajaxRequestType);return false;break;} r=this.getRequestObject();if(!r)return false;r.open(xajaxRequestType==xajaxDefinedGet?"GET":"POST",uri,true);if(xajaxRequestType==xajaxDefinedPost){try{r.setRequestHeader("Method","POST "+uri+" HTTP/1.1");r.setRequestHeader("Content-Type","application/x-www-form-urlencoded");} catch(e){alert("Your browser does not appear to  support asynchronous requests using POST.");return false;} } r.onreadystatechange=function(){if(r.readyState!=4) return;if(r.status==200){if(xajaxDebug&&r.responseText.length < 1000)xajax.DebugMessage("Received:\n"+r.responseText);else if(xajaxDebug)xajax.DebugMessage("Received:\n"+r.responseText.substr(0,1000)+"...\n[long response]\n...</xajax>");if(r.responseXML) xajax.processResponse(r.responseXML);else{alert("Error: the XML response that was returned from the server is invalid.");document.body.style.cursor='default';if(xajaxStatusMessages==true)window.status='Invalid XML response error';} } delete r;} if(xajaxDebug)this.DebugMessage("Calling "+sFunction+" uri="+uri+" (post:"+postData+")");r.send(postData);if(xajaxStatusMessages==true)window.status='Waiting for data...';delete r;return true;} 
context: 	this.call = function(sFunction, aArgs, sRequestType)	{		var i,r,postData;		if (document.body && xajaxWaitCursor)			document.body.style.cursor = 'wait';		if (xajaxStatusMessages == true) window.status = 'Sending Request...';		if (xajaxDebug) this.DebugMessage("Starting xajax...");		if (sRequestType == null) {		   var xajaxRequestType = xajaxDefinedPost;		}		else {			var xajaxRequestType = sRequestType;		}		var uri = xajaxRequestUri;		var value;		switch(xajaxRequestType)		{			case xajaxDefinedGet:{				var uriGet = uri.indexOf("?")==-1?"?xajax="+encodeURIComponent(sFunction):"&xajax="+encodeURIComponent(sFunction);				if (aArgs) {					for (i = 0; i<aArgs.length; i++)					{						value = aArgs[i];						if (typeof(value)=="object")							value = this.objectToXML(value);						uriGet += "&xajaxargs[]="+encodeURIComponent(value);					}				}				uriGet += "&xajaxr=" + new Date().getTime();				uri += uriGet;				postData = null;				} break;			case xajaxDefinedPost:{				postData = "xajax="+encodeURIComponent(sFunction);				postData += "&xajaxr="+new Date().getTime();				if (aArgs) {					for (i = 0; i <aArgs.length; i++)					{						value = aArgs[i];						if (typeof(value)=="object")							value = this.objectToXML(value);						postData = postData+"&xajaxargs[]="+encodeURIComponent(value);					}				}				} break;			default:				alert("Illegal request type: " + xajaxRequestType); return false; break;		}		r = this.getRequestObject();		if (!r) return false;		r.open(xajaxRequestType==xajaxDefinedGet?"GET":"POST", uri, true);		if (xajaxRequestType == xajaxDefinedPost)		{			try			{				r.setRequestHeader("Method", "POST " + uri + " HTTP/1.1");				r.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");			}			catch(e)			{				alert("Your browser does not appear to  support asynchronous requests using POST.");				return false;			}		}		r.onreadystatechange = function()		{			if (r.readyState != 4)				return;						if (r.status==200)			{				if (xajaxDebug && r.responseText.length < 1000) xajax.DebugMessage("Received:\n" + r.responseText);				else if (xajaxDebug) xajax.DebugMessage("Received:\n" + r.responseText.substr(0,1000)+"...\n[long response]\n...</xajax>");				if (r.responseXML)					xajax.processResponse(r.responseXML);				else {					alert("Error: the XML response that was returned from the server is invalid.");					document.body.style.cursor = 'default';					if (xajaxStatusMessages == true) window.status = 'Invalid XML response error';								}			}						delete r;		}		if (xajaxDebug) this.DebugMessage("Calling "+sFunction +" uri="+uri+" (post:"+ postData +")");		r.send(postData);		if (xajaxStatusMessages == true) window.status = 'Waiting for data...';		delete r;		return true;	}
meta: 8936	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/8936/e92bdf0de1d9e636ce0884356df4ebfb27222ea3/xajax.js/clean/trunk/3dparty/xajax/xajax_js/xajax.js