title: jQuery ajax POST from local file to access a cross domain not working
body: <p>As the title says, I'm trying to access (POST) using jQuery AJAX call to a web url, <code>http://host:port/...</code> or <code>http://localhost:8080/...</code> from a local HTML file, <code>c:\home.html</code>. I can't get it to work.</p>
  
  <p>I did Google and also saw several questions here but I can't get it to work. I need some help here. Here is what I've tried so far.</p>
  
  <ol>
  <li>dataType: jsonp</li>
  <li>crossDomain: true</li>
  <li>Setting the header in my response:</li>
  </ol>
  
  <pre class="lang-js prettyprint-override"><code>response.setHeader("Access-Control-Allow-Origin", "*");
  </code></pre>
  
  <p>None of the three browsers are working - IE, FF or Chrome. The request is never reaching the server. Here are some of the errors I'm seeing.</p>
  
  <ol>
  <li>No Transport (IE) if not jsonp is used.</li>
  <li>NS_BINDING_ABORTED / Error loading content (NS_ERROR_DOCUMENT_NOT_CACHED) in FF</li>
  </ol>
  
  <p>This is my code. I would appreciate any help. I'm using <code>jquery-1.8.2.min.js</code>.</p>
  
  <pre><code>var http_host =  "http://localhost:8080";
  
  function su (pc, p) {
      var suUrl = http_host + "/ps/api/v2/authorize.json";
  
      $.ajax({
          type: 'POST',
          url: suUrl,
          data: {
              phone_cell: pc,
              password: p,
          },
          dataType: "json",
          crossDomain: true,
          success: osu,
          error: oe
      });
      return false;
  }
  
  function osu (d) {
      console.log(d);
  }
  
  function oe(xhr, ts, et)     {
      alert("ServerError: " + et);
  }
  </code></pre>
  
  <p>An example would be a perfect pointer.</p>