简体   繁体   English

如何使用ajax调用调用应用程序脚本网络应用程序?

[英]How to call app script web app using ajax call?

I wrote one script to count my google form response but not able to call that function remotely through ajax call.我写了一个脚本来计算我的 google 表单响应,但无法通过 ajax 调用远程调用该函数。 It shows me some error它显示了一些错误

MIME type ('text/html') is not executable, and strict MIME type checking is enabled. MIME 类型 ('text/html') 不可执行,并且启用了严格的 MIME 类型检查。

$.getJSON('app script url', function(data) {
  console.log(data);
});

Since I can't comment yet I'll add a reply.由于我还不能发表评论,我会添加一个回复。 If you're experiencing a CORS issue you can try this CORS Proxy:如果您遇到 CORS 问题,可以尝试使用此 CORS 代理:

https://corsproxy.github.io/ https://corsproxy.github.io/

It might work but I don't think it could be a definitive solution.它可能有效,但我认为这不是一个明确的解决方案。 In order to get over a CORS (X domain scripting error) your probably need to configure the servers to accept requests from your domain.为了克服 CORS(X 域脚本错误),您可能需要配置服务器以接受来自您域的请求。

Read more about CORS: https://www.maxcdn.com/one/visual-glossary/cors/阅读有关 CORS 的更多信息: https : //www.maxcdn.com/one/visual-glossary/cors/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM