Created
July 17, 2013 12:14
-
-
Save opyate/6020023 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sendTestLead() { | |
callAjax("servlet/SendTestLead?order_id=165&product_id=1", alert); | |
} | |
function callAjax(url, f) { | |
var o = new Object(); | |
o.req = makeXMLHttpRequest(); | |
o.req.onreadystatechange = function() { | |
if(o.req.readyState == 4) | |
f(o.req.responseText); | |
} | |
o.req.open("GET", url, true); | |
o.req.send(""); | |
} | |
function makeXMLHttpRequest() { | |
var req; | |
// branch for native XMLHttpRequest object | |
if(window.XMLHttpRequest) { | |
try { | |
req = new XMLHttpRequest(); | |
} catch(e) { | |
req = false; | |
} | |
// branch for IE/Windows ActiveX version | |
} else if(window.ActiveXObject) { | |
try { | |
req = new ActiveXObject("Msxml2.XMLHTTP"); | |
} catch(e) { | |
try { | |
req = new ActiveXObject("Microsoft.XMLHTTP"); | |
} catch(e) { | |
req = false; | |
} | |
} | |
} | |
return req; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment