parthasarathy B

parthasarathy B

  • NA
  • 927
  • 107.4k

Cross-Origin Read Blocking (CORB) blocked cross-origin

Oct 24 2018 2:04 AM
Hi all,
          I am calling external webservice in sharepoint office 365 using ajax call. I am using the following code to acces the external webservice.But i am getting the following error.
"Cross-Origin Read Blocking (CORB) blocked cross-origin response with MIME type application/json" . Any help would be helpful.Thanks in advance.
 
  1. <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js" type="text/javascript"></script>  
  2. <script type="text/javascript">  
  3. $(function () {  
  4. debugger;  
  5. try  
  6. {  
  7. $.ajax({  
  8.             url: "https://api.printful.com/countries",  
  9.             headers: {  
  10.             'Access-Control-Allow-Credentials' : true,  
  11.             'Access-Control-Allow-Origin''*',  
  12.             'Access-Control-Allow-Methods':'GET',  
  13.             'Access-Control-Allow-Headers':'application/json',  
  14.              },  
  15.         type: "GET",  
  16.             crossDomain: true,  
  17.             dataType: "jsonp",  
  18.             jsonp: 'jsonp-callback',  
  19.         async: false,           
  20.         success: function (data) {  
  21.                debugger;  
  22.              console.log("count= "+ data.d.results.length);  
  23.             if(data.d.results.length>0){  
  24.                 alert("Results Count:"+data.d.results.length);  
  25.             }else{  
  26.                 alert("no data");  
  27.             }  
  28.         },  
  29.         error: function (data) {  
  30.                 console.log("Error");  
  31.             console.log(data);                  
  32.         }  
  33.     });  
  34. }  
  35. catch(e)  
  36. {  
  37. console.log(e);  
  38. }  
  39.     });  
  40.   
  41. </script>  
 

Answers (1)