title: How to get a response from a javascript post request
body: <p>So I'm using this post request I found on here, but I'm wondering how I receive a response using this...</p>
  
  <pre><code>function post_to_url(path, params, method) {
      method = method || "post"; 
      var form = document.createElement("form");
      form.setAttribute("method", method);
      form.setAttribute("action", path);
  
      for(var key in params) {
          if(params.hasOwnProperty(key)) {
              var hiddenField = document.createElement("input");
              hiddenField.setAttribute("type", "hidden");
              hiddenField.setAttribute("name", key);
              hiddenField.setAttribute("value", params[key]);
  
              form.appendChild(hiddenField);
           }
      }ody.appendChild(form);
      form.submit();
  }
  </code></pre>
  
  <p>Thanks in advance.</p>