title: WinHttpRequest equivalent in Javascript
body: <p>I am looking to use an API from my webpage and currently have a working VB example that works in VBA and was hoping that an equivalent method could be created in Javascript</p>
  
  <pre><code>Set http = CreateObject("WinHttp.WinHttpRequest.5.1")
  http.Open "POST", "https://api.net.nz/Service.svc", False
  http.setProxy 2, "http://proxynz", ""
  http.Option(4) = intSslErrorIgnoreFlags
  http.Option(6) = False
  http.setRequestHeader "Content-Type", "text/xml; charset=utf-8"
  http.setRequestHeader "SOAPAction", "urn:WebServices/ISaleService/CreateSale"
  http.send (strXML)
  Post = http.responsetext
  </code></pre>
  
  <p>The code that I have been working with is here and I think the issue lies with the http.setProxy line in the VB code.</p>
  
  <pre><code>$.ajax({
      type: "POST",
      url: "https://api.net.nz/Service.svc",
      dataType: 'xml',
      contentType: "text/xml; charset=\"utf-8\"",
      beforeSend: function (xhr) {
          xhr.setRequestHeader('SOAPAction', 'urn:WebServices/ISaleService/CreateSale');
      },
      data: strXML,
      async: false,
      success: function (data) {alert(data);},
      error: function (xhr, status, error) {$('#results').html(error);alert(error)}
  });
  </code></pre>
  
  <p>With the above code I am getting an error message saying</p>
  
  <p>Error: NETWORK_ERR: XMLHttpRequest Exception 101</p>
  
  <p><strong>Update</strong>
  Still looking for a solution for this. I am hoping that someone knows how to reference a proxy for an $.ajax request.</p>