NS_Error_Failure on Javascript POST
<p>I am having trouble with some javascript. The code snippet below creates a simple post request however it always throws an <code>NS_Error_failure</code> exception (details at the bottom of the page). Can anyone tell me whats wrong with this code?</p>

<p></p>

<pre><code>window.onload = function () {

    alert('0');
    try {
        var url = "Some URL";
        var request = CreateHttpRequest();
        if (request) {
            alert('1');
            request.open("POST", url, false);
            request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
            alert('2');
            request.send('');
            alert('3');
        }
    }
    catch (err) {
        alert(err);
    }
}
</code></pre>

<p></p>

<pre><code>    [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE)"
     nsresult: "0x80004005 (NS_ERROR_FAILURE)"  
     location: "JS frame :: file:///C:/Users/Ben/Desktop/test.html :: &lt;TOP_LEVEL&gt; :: line 44"  data: no]
</code></pre>
