I am currently writing a very basic HTML application which uses JavaScript to make a call to a REST API (for what it's worth, it's the HBase REST API). Currently my call does not give any appropriate response: response code of 0 (which I understand is not a legitimate response code, but essentially an empty response); empty statusText; empty responseText.

My instinct with this kind of response would be that the problem is with my URL; I therefore output the URL. The URL ends up being as follows: `http://hbase_server.com:8080/table_name/key`

I then executed `curl -i http://hbase_server.com:8080/table_name/key` and this gave me exactly the response I was expecting, indicating that my URL at least is correct, and therefore the problem must be with my request. I'm posting the code below. Since I have incredibly limited experience with JavaScript, it is very likely I have made an obvious error.

```
function sendRequest()
{
    var key = document.getElementById("Key").value;
    var url = "http://hbase_server:8080/table_name/" + key + "";
    var req = new XMLHttpRequest()
    // Create the callback:
    req.onreadystatechange = function() {
        if (req.readyState != 4) return; // Not there yet
        if (req.status != 200) {
            document.getElementById("result").innerHTML = "Status: " + req.statusText;
            return;
        }
        // Request successful, read the response
        var resp = req.responseText;
        document.getElementById("result").innerHTML = resp;
    }
    req.open("GET", url, true);
    req.send();
    document.getElementById("result").innerHTML = url;
}

```