title: jQuery POST to localhost returns HTTP 501 error
body: <p>I am trying to make a jQuery POST request from a locally hosted web-page to a locally hosted server. </p>
  
  <p>My server listens at 
  When I send a POST request using my <a href="https://luckymarmot.com/paw" rel="nofollow noreferrer">HTTP client</a>, I receive a <code>201 created</code> response, as I expect.</p>
  
  <p>Now, I try to send the same request using jQuery: </p>
  
  <pre><code>function postAppointment() {
  
      $.post({
          url:'http://localhost:8085/appointments',
          data: appointmentFactory(),
          crossDomain: true,
          headers: {
              'Content-Type' : 'application/json',
              'Accept' : 'application/json'
  
          }
      });
  }
  </code></pre>
  
  <p>I receive the following error message from the Safari error console: </p>
  
  <pre><code>[Error] Failed to load resource: the server responded with a status of 501 (Not Implemented) ([object Object], line 0)
  </code></pre>
  
  <p>However, I'm not so sure the server is actually responding, because I have tried sending the requests to <code>netcat</code> and it is not printing out any requests, while if I use my GUI HTTP client, <code>netcat</code> does print out the requests.</p>
  
  <p>So... to me this seems to be a client-side issue, since my backend-service is confirmed to be working by my GUI HTTP client. I thought maybe this problem has to do with how I am serving my page, so I have tried serving the page:</p>
  
  <ol>
  <li>Opening directly from the Finder</li>
  <li>Opening via IDE link which seems to run a server (JetBrains WebStorm)</li>
  <li><code>python -m SimpleHTTPServer</code></li>
  </ol>
  
  <p>Is there a client-side configuration I am missing which is preventing me from sending a request?</p>
  
  <p>Thanks for any help.</p>
  
  <p>And in case you are wondering, <code>appointmentFactory()</code> returns </p>
  
  <pre><code>Object
  eventName: "Fiesta Forever"
  phoneNumber: "13125555555"
  time: Thu Dec 18 2014 17:15:00 GMT-0600 (CST)
  __proto__: Object
  </code></pre>
  
  <p>And I have also sent the request by parsing the object with <code>JSON.stringify()</code>.... I'm not sure if that is done automatically.</p>
  
  <p>I also tried the request via Desktop Chrome, and received the following additional information:
  <img src="https://i.stack.imgur.com/Yu4hh.png" alt="enter image description here"></p>
  
  <p>Thanks again for any help.</p>
  
  <p>-Blake</p>