title: jQuery .ajax() POST Request throws 405 (Method Not Allowed) on RESTful WCF
body: <p>I am sending a post request to a RESTFUL WCF service application.  I am able to successfully send a <code>POST</code> request through Fiddler. </p>
  
  <p>However when I do this through the jQuery Ajax method the function returns the following to the Chrome Developer Console:</p>
  
  <pre><code>OPTIONS http://www.example.com/testservice/service1.svc/GetData 405 (Method Not Allowed) jquery.min.js:6
  </code></pre>
  
  <p>But then a second after logs:</p>
  
  <pre><code>Object {d: "You entered 10"} testpost.html:16
  </code></pre>
  
  <p>What this tells me is that jQuery is sending a <strong><code>OPTIONS</code></strong> request, which fails, and then sending a <code>POST</code> request which returns the expected data. </p>
  
  <p>My jQuery Code:</p>
  
  <pre><code>$.ajax() {        
  type: "POST", //GET or POST or PUT or DELETE verb 
      url: "http://www.example.com/testservice/service1.svc/GetData", // Location of the service      
      data: '{"value":"10"}', //Data sent to server
      contentType:"application/json",
      dataType: "json", //Expected data format from server    
      processdata: false,
      success: function (msg) {//On Successfull service call   
          console.log(msg);
      },
      error: function (xhr) { console.log(xhr.responseText); } // When Service call fails             
  });
  </code></pre>
  
  <p>I am using jQuery version 2.0.2.</p>
  
  <p>Any help on why this error is occurring would be a great help.</p>