title: Access-Control-Allow-Origin error sending a jQuery Post to Google API's
body: <p>I read a lot for the 'Access-Control-Allow-Origin' error, but I don't understand what I have to fix :(</p>
  
  <p>I'm playing with Google Moderator API, but when I try to <a href="http://code.google.com/apis/moderator/v1/using_rest.html#CreatingSeries" rel="noreferrer">add new serie</a> I receive:</p>
  
  <pre><code>XMLHttpRequest cannot load 
  https://www.googleapis.com/moderator/v1/series?key=[key]
  &amp;data%5Bdescription%5D=Share+and+rank+tips+for+eating+healthily+on+the+cheaps!
  &amp;data%5Bname%5D=Eating+Healthy+%26+Cheap
  &amp;data%5BvideoSubmissionAllowed%5D=false. 
  Origin [my_domain] is not allowed by Access-Control-Allow-Origin.
  </code></pre>
  
  <p>I tried with and without callback parameter, I tried to add 'Access-Control-Allow-Origin *' to the header. And I don't know how to use $.getJSON here, if apply, because I have to add the Authorization header and I don't know how to do it without beforeCall from $.ajax :/ </p>
  
  <p>Any light for this darkness u.u?</p>
  
  <p>That's the code:</p>
  
  <pre><code>&lt;script src="http://www.google.com/jsapi"&gt;&lt;/script&gt;
  
  &lt;script type="text/javascript"&gt;
  
  var scope = "https://www.googleapis.com/auth/moderator";
  var token = '';
  
  function create(){
       if (token == '')
        token = doCheck();
  
       var myData = {
        "data": {
          "description": "Share and rank tips for eating healthily on the cheaps!", 
          "name": "Eating Healthy &amp; Cheap", 
          "videoSubmissionAllowed": false
        }
      };
  
      $.ajax({
  
          url: 'https://www.googleapis.com/moderator/v1/series?key='+key,
          type: 'POST',
          callback: '?',
          data: myData,
          datatype: 'application/json',
          success: function() { alert("Success"); },
          error: function() { alert('Failed!'); },
          beforeSend: setHeader
  
      });
  }
  
  function setHeader(xhr) {
  
    xhr.setRequestHeader('Authorization', token);
  }
  
  function doLogin(){ 
      if (token == ''){
         token = google.accounts.user.login(scope);
      }else{
         alert('already logged');
      }
  }
  
  
  function doCheck(){             
      token = google.accounts.user.checkLogin(scope);
      return token;
  }
  &lt;/script&gt;
  ...
  ...
  &lt;div data-role="content"&gt;
      &lt;input type="button" value="Login" onclick="doLogin();"&gt;
      &lt;input type="button" value="Get data" onclick="getModerator();"&gt;
      &lt;input type="button" value="Create" onclick="create();"&gt;
  &lt;/div&gt;&lt;!-- /content --&gt;
  </code></pre>