title: Does XMLHttpRequest object close after response received?
body: <p>I'm trying to connect to the server using an XMLHttpRequest object to post data at different times. I create an object and "connect" to the server like so: </p>
  
  <pre><code>var xhr = new XMLHttpRequest();
  xhr.open("post", location, true);
  xhr.send(); //Is this send call needed to open the connection?
  </code></pre>
  
  <p>And at a later point in time, I call something like this:</p>
  
  <pre><code>xhr.send("Something to send");
  </code></pre>
  
  <p>However, looking at the developer console, it seems that only the initial request went through (and successfully responded). The second request doesn't seem to send. I'm trying to narrow down what could be the problem, so I thought: could the connection be closed once the response is received; Why would it be kept open? So, my question: Is the XMLHttpRequest object connection closed once it receives a response? If so, what's the best way to simulate a continuously open connection (to constantly reconnect?)?</p>