以下代码已成功检索JSON数据,但不适用于 本地主机和jsFiddle
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.twitter.com/1.1/trends/available.json",
"method": "GET",
"headers": {
"Authorization": "OAuth oauth_consumer_key=\\\"Pd4vyx4AsNv3jdMja0cNCXilN\\\",oauth_signature_method=\\\"HMAC-SHA1\\\",oauth_timestamp=\\\"1537443447\\\",oauth_nonce=\\\"WsA8VV16BfF\\\",oauth_version=\\\"1.0\\\",oauth_signature=\\\"M%2BPZVPbFSnxkxeDxFLxC1eKYHdY%3D\\\""
}
}
$.ajax(settings).done(function (response) {
console.log(response);
});