can i get the html of the url by xmlhttprequest at clientside using javascript?
<p>I need to retreive the page source of the url using XMLhttpRequest in javascript.I tried it but i'm not getting any response. Following is my code and i'm getting blank response.text</p>

<pre><code>function pagesource(url) {
    var request = makeHttpObject();
    request.open("GET", url, true);
    request.send(null);
    request.onreadystatechange = function () {
        if (request.readyState == 4) {
            if (request.status == 200) {
                alert(request.responseText);
            }
        }

    };   
}

function makeHttpObject() {
    try { return new XMLHttpRequest(); }
    catch (error) { }
    try { return new ActiveXObject("Msxml2.XMLHTTP"); }
    catch (error) { }
    try { return new ActiveXObject("Microsoft.XMLHTTP"); }
    catch (error) { }
    throw new Error("Could not create HTTP request object.");
}
</code></pre>
