【发布时间】:2017-10-13 21:45:55
【问题描述】:
现在我正在尝试从 freecodecamp 进行随机报价生成器挑战。
但是,我在从网站上获取报价时遇到了很多麻烦
http://api.forismatic.com 由于 CORS ...然后我偶然发现了某人的解决方案,但我不明白他为什么在 url 末尾包含查询 jsonp=?。
他创造了:
// Random Quote Generator
var url = "http://api.forismatic.com/api/1.0/?method=getQuote&key=457653&format=jsonp&lang=en&jsonp=?";
除了最后的jsonp=? 之外,我关注所有内容...
我知道必须有一个回调,我试图用callback=? 替换它
但随后出现错误:
"Refuse to execute script from (data resource) because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled."
【问题讨论】: