javascript - AJAX

function loadAJAX(url) {
     try {
        var xmlhttp;
        if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
           xmlhttp = new XMLHttpRequest();
        }
        else {// code for IE6, IE5
           xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        }

        xmlhttp.onreadystatechange = function() {
           if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
              alert(xmlhttp.responseText);
           }
        }

        xmlhttp.open("GET", url, true);
        xmlhttp.send();
     }
     catch (err) {
        alert("Error:" + err.description);
     }
}

Popular posts from this blog

SAP CPI - Loop Process Call with SuccessFactor (oData V2)

Setting IntelliJ IDEA to run Groovy Script

C# - BASE64 to Image