function xmlHttpPost(targetURL, queryString , functionNotReady, functionErr, functionSuccess) { var xmlHttpReq = false; var self = this; if (typeof functionNotReady != 'undefined') { var fNotReady = new Function(functionNotReady); } if (typeof functionErr != 'undefined') { var fErr = new Function(functionErr); } if (typeof functionSuccess != 'undefined') { var fSuccess = new Function(functionSuccess); } // check for mozilla / safari / ie if (window.XMLHttpRequest) { // mozilla / safari self.xmlHttpReq = new XMLHttpRequest(); } else if (window.ActiveXObject) { // ie self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP"); } self.xmlHttpReq.open('POST', targetURL, true); self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); var requestTimer = setTimeout(function() { self.xmlHttpReq.abort(); }, 30000); self.xmlHttpReq.onreadystatechange = function() { if (self.xmlHttpReq.readyState != 4) { fNotReady(); return; } clearTimeout(requestTimer); if (self.xmlHttpReq.status != 200) { fErr(); } else { fSuccess(); } } self.xmlHttpReq.send(queryString); }