title: Ajax method is getting a 405 error when I try to consume a WCF Service
body: <p>I have an enabled CORS WCF Service and the other hand, I have a Rails app where I'm trying to make a request via Ajax (I manually ran this at Browser Debug Console):</p>
  
  <pre><code>function GetBookId(){
  
  $.ajax({
     type: "GET",
     url:  "http://localhost:8369/BookService.svc/Book/3",
     contentType: "json",
     dataType: "json",
     xhrFields: {
        withCredentials: false 
      },
     headers: "GET",
     //processData: true,
     success: function (data) {
      var jsonData = JSON.stringify(data);
      var objData = $.parseJSON(jsonData);
      var bookId = objData.BookId;
      var isbn = objData.ISBN;
      },
      error: function (xhr) {
          alert(xhr.responseText);
      }
    });
  } 
  </code></pre>
  
  <p>The WCF Service is running at port 8369, and my Rails app is at port 3000, so browsers complain about Cross-Domain or Cross-Origin preflight requests with a Error 405. As I said, the WCF Service is enabled to receive GET, POST, PUT and DELETE methods:</p>
  
  <pre><code>...
      &lt;httpProtocol&gt;
        &lt;customHeaders&gt;
          &lt;add name="Access-Control-Allow-Origin" value="*" /&gt;
          &lt;add name="Access-Control-Allow-Methods" value="GET, POST, PUT, DELETE, OPTIONS" /&gt;
        &lt;/customHeaders&gt;
      &lt;/httpProtocol&gt;
  ...
  </code></pre>
  
  <p>After debugging or watching the Request Headers, I found when I use the <code>GetBookId()</code> method, Is sending <code>OPTIONS</code> as Request Method instead a GET or POST, so get that </p>
  
  <blockquote>
    <p>XMLHttpRequest cannot load
    <a href="http://localhost:8369/BookService.svc/Book/3" rel="nofollow">http://localhost:8369/BookService.svc/Book/3</a>. Response for preflight
    has invalid HTTP status code 405</p>
  </blockquote>
  
  <p>In Firefox Developer Tools I edited the Request Header as a GET Method and send it again. The Response was a 200. So I guess that problem is that. The jQuery ajax method is sending a wrong Method, How can I send it properly with this method? </p>