title: Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at .../Signature.asmx/SendIdDocuments
body: <p>I have created a webservice using vb.net. It as an asmx class that contain:</p>
  <pre><code>'To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following 
  line.
  &lt;System.Web.Script.Services.ScriptService()&gt;
  &lt;System.Web.Services.WebService(Namespace:=&quot;http://tempuri.org/&quot;)&gt;
  &lt;System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)&gt;
  &lt;ToolboxItem(False)&gt;
  Public Class Signature
  Inherits System.Web.Services.WebService
  
  &lt;WebMethod()&gt;
  &lt;ScriptMethod(ResponseFormat:=ResponseFormat.Json)&gt;
   Public Function SendIdDocuments(ByVal idPaziente As Object)
   MsgBox(&quot;sucessssssss&quot;)
   MsgBox(idPaziente)
   Return &quot;test&quot;
   End Function
   End Class
  </code></pre>
  <p>I invoke this ws from ajax:</p>
  <pre><code>  function callService() {    
    $(&quot;[id*=documentiGrid] input[type=checkbox]:checked&quot;).each(function () {
    var row = $(this).closest(&quot;tr&quot;)[0];
    selected.push(row.cells[6].innerHTML);
    });
  
    selectedJson = JSON.stringify(selected);
       $.ajax({
                  url: '.../Signature.asmx/SendIdDocuments',
                  data: selectedJson,
                  dataType: &quot;jsonp&quot;,
                  type: &quot;POST&quot;,
                  crossDomain: true,
                  contentType: &quot;application/json;charset=UTF-8&quot;,      
                  success: function (data) {
                      console.log(&quot;succes&quot;);
                  },              
                  error: function (response) {
                      console.log(&quot;error&quot;);
                  },
                  failure: function (response) {
                      console.log(&quot;failure&quot;);
                  }
              });
      }
  </code></pre>
  <p>I call callService() function in a button click. When I try this from postman it works perfectly but when I try this from my project it throws this error:</p>
  <p>Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://.../Signature.asmx/SendIdDocuments. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).</p>
  <p>Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://.../Signature.asmx/SendIdDocuments. (Reason: CORS request did not succeed)</p>
  <p>I saw some choices for cross origin blocked which says that changing data-type from json to jsonp solves the issue, but jsonp is used just for GET method and in my case doesnt work because I need to use POST.
  Any help? :)</p>