After successfully testing the query string in the browser for my published app script, I attempted to send an XMLHttpRequest to the script. However, upon doing so, I encountered the following error message:
XMLHttpRequest cannot load https://script.google.com/macros/s/XXXXXXXXXX/exec. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://docs.google.com' is therefore not allowed access.
This snippet showcases the app script code utilized:
function doGet(e){
Logger.log(e.parameter.id);
//other function
return ContentService.createTextOutput("Hello World");
}
Additionally, provided below is the client-side code utilized:
$.ajax({
url:'https://script.google.com/macros/s/XXXXXXXX/exec',
method:'POST',
data:{
id: "123123"
},
success:function(){
console.log("success");
}
});