无法从第 3 方网站获取 JSON

Can't getJSON from 3rd party website

我想得到

https://www.g2a.com/lucene/search/quick?jsoncallback=jQuery1110048787688104918936_1507980736882&phrase=punch&isWholesale=false&cc=PL&skip=&start=0&rows=5&_=1507980736886

这是对在搜索框中搜索的 g2a 的响应。我试过这个:

$.ajax({
url: url,
type: "GET",
dataType: "jsonp",
success: function (data) {
    console.log(data);
}});

但是我得到一个错误:

jquery-3.2.1.min.js:4 Refused to load the script 'https://www.g2a.com/lucene/search/quick?jsoncallback=jQuery1110048787688104918936_1507980736882&phrase=s&isWholesale=false&cc=PL&skip=&start=0&rows=5&&callback=jQuery32104612888467884788_1507987847332&_=1507987847333' because it violates the following Content Security Policy directive: "script-src 'self' blob: filesystem: chrome-extension-resource:".

如您所见,它是一个 chrome 扩展,因此它不能包含一些 PHP 脚本,这些脚本可以在网上找到。

您必须在 menifest.json 中为服务器添加一个条目,类似于以下内容-

"content_security_policy": "script-src 'self' https://www.g2a.com; object-src 'self'"