title: Cross-Origin Request Blocked Reason: CORS preflight channel did not succeed
body: <p>I've created one phonegap app where I'm calling WCF service which resides in nopCommerce plugin.</p>
  
  <p>I'm getting following error while sending api request:</p>
  
  <blockquote>
    <p>Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at <a href="http://testwebsite.com/Plugins/NopRestApi/RemoteService/WebService.svc/GetData" rel="nofollow noreferrer">http://testwebsite.com/Plugins/NopRestApi/RemoteService/WebService.svc/GetData</a>. (Reason: CORS preflight channel did not succeed).</p>
    
    <p>Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at <a href="http://testwebsite.com/Plugins/NopRestApi/RemoteService/WebService.svc/GetData" rel="nofollow noreferrer">http://testwebsite.com/Plugins/NopRestApi/RemoteService/WebService.svc/GetData</a>. (Reason: CORS request failed).</p>
  </blockquote>
  
  <p><strong>API call using Ajax</strong></p>
  
  <pre><code>$.ajax({
    crossDomain: true,
    type: "POST",
    contentType: "application/json",
    async: false,
    url: "http://testwebsite.com/Plugins/NopRestApi/RemoteService/WebService.svc/GetData",
    data: "{storeId:" + storeId + ", languageId:" + languageId + ", customerId:" + customerId + "}",            
    //data: { storeId: storeId, languageId: languageId, customerId: customerId },
    dataType: 'json',
    //jsonp: false,
    success: function (data) {
        alert(data.d);                
    },
    error: function (xhr, textStatus, error) {
        alert("Error! " + error);                
    }
  });
  </code></pre>
  
  <p>I've added following in my Web.config file by some research on google.</p>
  
  <pre><code>&lt;httpProtocol&gt;
    &lt;customHeaders&gt;
      &lt;add name="Access-Control-Allow-Origin" value="*" /&gt;
      &lt;add name="Access-Control-Allow-Headers" value="Content-Type" /&gt;
    &lt;/customHeaders&gt;
  &lt;/httpProtocol&gt;
  </code></pre>
  
  <p>I've tried many ways even disabled browser cross origin request check by following <a href="https://stackoverflow.com/questions/12926997/how-to-temporarily-disable-xss-protection-in-modern-browsers-for-testing">How to temporarily disable XSS protection in modern browsers for testing?</a> link but still same issue persist.</p>
  
  <p>Does anyone have similar issue and resolved?</p>
  
  <p>Thanks!</p>