function ajaxReq(strURL, strSubmit, strResultFunc) { var xmlHttpReq = false; // Mozilla/Safari/IE7 if (window.XMLHttpRequest) { xmlHttpReq = new XMLHttpRequest(); if (xmlHttpReq.overrideMimeType) xmlHttpReq.overrideMimeType('text/xml'); // this would break IE7.. } // <=IE6 else if (window.ActiveXObject) { xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP"); } xmlHttpReq.open('POST', strURL, true); xmlHttpReq.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); xmlHttpReq.onreadystatechange = function() { if (xmlHttpReq.readyState == 4) { if (xmlHttpReq.status == 200) { if (strResultFunc) { // Run result function if (typeof strResultFunc == "string") eval(strResultFunc+'(xmlHttpReq);'); else eval(strResultFunc(xmlHttpReq)); } else // if no result function was specified, simply return true. return true; } } } xmlHttpReq.send(strSubmit); }