title: POST data to a Google form with AJAX
body: <p>I am trying to post data to a from AJAX to a Google form, but even though it reports success with a statusCode of 0, the data never appears in the form:</p>
  
  <pre><code>var dat={ "entry.529474552" :"data1", "entry.1066559787": "name1"};
  postToGoogle("1FAIpQLSf4w1OQGsIncaiqXlmfAl4jYSt-e4Zx3xVJa7Weob4LnQbRZQ",dat);
  
  function postToGoogle(id, dat) {
      $.ajax({
          beforeSend: function (xhr) {
              xhr.setRequestHeader('Access-Control-Allow-Origin', 'chrome-extension://EXTENSION_ID');
              xhr.setRequestHeader('Access-Control-Allow-Methods', 'GET, POST, PUT');
              },
          url: "https://docs.google.com/forms/d/e/"+id+"/formResponse",
          data: dat, 
          type: "POST",  
          dataType: "xml",
          xhrFields: {  withCredentials: true },
          statusCode: {
              0:   function() {  console.log("OK") },
              200: function() {  console.log("error") },
              }
          });
      }
  </code></pre>
  
  <p>It generates a CORS error, but supposedly, the POST should go through anyway.</p>