I try to call a script published on Google App script from a .js file by Ajax. It works very fine when I use the url directly on the browser (I get the Json answer), however I keep getting a "Cross-Origin Read Blocking (CORB) blocked cross-origin response with MIME type text/html" when the call is done from Ajax locally.
Any idea how this could be fixed ??
function doGet(e) {
Logger.log('I was called finaly');
var data = "some data";
var result = JSON.stringify({data: data});
return ContentService
.createTextOutput(e.parameter.callback + "(" + result + ")")
.setMimeType(ContentService.MimeType.JAVASCRIPT);
}
let callGoogleScript = (user) => {
console.log("callGoogleScript triggered");
var link = "https://script.google.com/macros/s/123/exec";
var url = link + "?callback=answer&name=";
$.ajax({
crossDomain: true,
url: url + encodeURIComponent(user),
method: "GET",
dataType: 'jsonp'
});
}