0

I have called this API using Jquery AJAX. I am getting following error in console:

> assets.min.js:3 Cross-Origin Read Blocking (CORB) blocked cross-origin response https://lrimsfaoaf.ait.ac.th/geoserver/wfs?format_options=callback:handleJson&service=WFS&version=1.1.0&request=GetFeature&typename=geonode%3Adistrict_boundaries&CQL_FILTER=Prov_Name%3D%27Badghis%27&srsname=EPSG%3A4326&outputFormat=text%2Fjavascript&_=1608092744277 with MIME type application/xml. See https://www.chromestatus.com/feature/5629709824032768 for more details.
send @ assets.min.js:3
ajax @ assets.min.js:3
$.ajax @ assets.min.js:3
handleAjax @ leafletControl.js:265
(anonymous) @ zoomBasedOnLayer.js:21
dispatch @ assets.min.js:3
v.handle @ assets.min.js:3

Here's my ajax function:

function handleAjax(column, value, adminUnit = "AFG_adm2") {
  $.ajax("https://lrimsfaoaf.ait.ac.th/geoserver/wfs", {
    type: "GET",
    data: {
      service: "WFS",
      version: "1.1.0",
      request: "GetFeature",
      typename: `geonode:${adminUnit}`,
      CQL_FILTER: `${column}='${value}'`,
      srsname: "EPSG:4326",
      outputFormat: "text/javascript",
    },
    dataType: "jsonp",
    jsonpCallback: "callback:handleJson",
    jsonp: "format_options",
  });
}

I have tried with CORS extensions but the issue is still there.

Mads Hansen
  • 63,927
  • 12
  • 112
  • 147
  • The API don't support CORS the only way to make this working is to use CORS proxy that you host somewhere or using existing free proxy. Check [10 Free to Use CORS Proxies](https://nordicapis.com/10-free-to-use-cors-proxies/) – jcubic Dec 16 '20 at 10:44
  • Please let me know if any of this is helpful. https://stackoverflow.com/questions/50873764/cross-origin-read-blocking-corb and https://stackoverflow.com/questions/55159973/how-to-solve-this-problem-cross-origin-read-blocking-corb-blocked-cross-orig and https://stackoverflow.com/questions/3506208/jquery-ajax-cross-domain – react_or_angluar Feb 11 '21 at 19:17

0 Answers0