title: Posting form with Ajax to a different server getting is not allowed by Access-Control-Allow-Origin error
body: <pre><code>  $this-&gt;output-&gt;set_header("Access-Control-Allow-Origin: *");
  </code></pre>
  
  <p>This line seems to work for accessing pages from another server via ajax but when I try to post data to another server I'm still getting an error even though the line above is in my script.</p>
  
  <p>Here is the Ajax I'm using to post the data.</p>
  
  <pre><code>         $.ajax({
              url: "' . base_url('pagehere') . '",
              type: "POST",
              data: "type=pform&amp;ip="+ip+"&amp;host_server="+host_server+"&amp;mediabar="+mediabar+fields,
              success: function(msg) {
                  $("#panelform").hide();
                  $(".pthankyou").show();
              }
              });
  </code></pre>
  
  <p>Here is what I have on the page I'm posting to:</p>
  
  <pre><code>        $this-&gt;output-&gt;set_header("Access-Control-Allow-Origin: *");
          $this-&gt;output-&gt;set_header("Access-Control-Allow-Methods: POST");
  </code></pre>
  
  <p>I'm not sure what else I need to make this work.</p>