Getting response from server in javascript
<p>How does I get the response from the server in JavaScript? This is my sample code:</p>

<pre><code>function get_Image(values) {
    if (window.XMLHttpRequest) {
        var http_request = new XMLHttpRequest();
    } else if (window.ActiveXObject) {
        var http_request = new ActiveXObject("Microsoft.XMLHTTP");
    } else {
        http_request.open("GET", "http://sample_address_for_server", true);
        http_request.send();
    }
    alert(http_request.status);
    if (http_request.readyState == 4) {
        if (http_request.status == 200) {
            xmlDoc = http_request.responseText;
            alert(xmlDoc);
        }
    }
}
</code></pre>
