title: xmlhttprequest to get encryption key + html form - what am I doing wrong
body: <p>The final stage of my project is to connect my website to a bank payment gateway to allow people to buy things using credit cards but without storing any credit card data on my site. I've been on Google and stackoverflow and think I'm on the right track but am obviously doing something wrong.</p>
  
  <p>The idea is that as the form opens an http-post happens which sends a set of parameters to the gateway which responds with a nice long encryption string which I use to submit the actual order. I'd appreciate some help here as I'm now quite stuck.</p>
  
  <pre><code>&lt;form method="post" action="/A55D74/fwcdirect.nsf/encrypt?OpenForm&amp;amp;Seq=1" name="_encrypt"&gt;
  &lt;input type="hidden" name="__Click" value="0" /&gt;&lt;form action="https://encryption-gateway-url.e" method="post"&gt;
  &lt;script&gt;
    var url = "valid-url"; 
    var params = "clientid=12&amp;password=xyz&amp;chargetype=Auth&amp;currency=42&amp;total=1.00";
    xmlhttp = new XMLHttpRequest(); 
    xmlhttp.open("post", url, true); 
    xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); 
    xmlhttp.send(params); 
    return xmlhttp.responseText;
  &lt;/script&gt;
  &lt;input type="hidden" name="returnurl" value="http://www.mywebsite.co.uk/"&gt; 
  &lt;input type="hidden" name="merchantdisplayname" value="Website + Shopping cart"&gt;
  &lt;input type="submit" value="10.00"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>9th April: I still haven't cracked the problem yet although am getting an error response from the gateway server, I'm currently exploring dojo which is looking very promising and as a bonus comes pre-installed with Lotus Notes client &amp; server (Domino 8.5.1 has dojo 1.3.2).</p>