/// How to call // ----------------------------------------------- // oneajax('1.php','id=1&,cd=12','ProcesMsgId','OutPutId') //
// ----------------------------------------------- /////////////////// user defined functions function oneajax(CallFile,CallArguments,OutPutDivID) { var CallFile=CallFile; var i_myDivID_,i_outDivID_,i_xmlHttp; i_myDivID_=OutPutDivID; i_outDivID_=OutPutDivID; if(CallFile.length==0) { document.getElementById(i_myDivID_).innerHTML = ""; document.getElementById(i_myDivID_).style.display = "none"; return; } // try { // Firefox, Opera 8.0+, Safari i_xmlHttp=new XMLHttpRequest(); } catch (e) { // Internet Explorer try { i_xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { i_xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } } // if(i_xmlHttp==null) { alert("Your browser does not support AJAX!"); return; } // var elevalues = ""; //document.write(elevalues); var params = CallArguments; // var url = CallFile; var params=CallArguments; i_xmlHttp.open("POST",url,true); i_xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); i_xmlHttp.setRequestHeader("Content-length", params.length); i_xmlHttp.setRequestHeader("Connection", "close"); i_xmlHttp.onreadystatechange=function() { if(i_xmlHttp.readyState==1) { document.getElementById(i_myDivID_).style.display = "block"; document.getElementById(i_myDivID_).innerHTML = "
";
}
if(i_xmlHttp.readyState==4 && i_xmlHttp.status == 200)
{
if(i_outDivID_.length!=0)
{
document.getElementById(i_outDivID_).innerHTML=i_xmlHttp.responseText;
}
}
}
i_xmlHttp.send(params);
}