我想从以下链接获取json数据http://pubapi.cryptsy.com/api.php?method=singlemarketdata&marketid=132。它应该为我提供以下JSON数据(显示数据的某些部分。无法使用jquery.getJSON()获取json数据
{
"success": 1,
"return": {
"markets": {
"DOGE": {
"marketid": "132",
"label": "DOGE\/BTC",
"lasttradeprice": "0.00000194",
"volume": "862686257.04978180",
"lasttradetime": "2014-02-24 03:26:52",
"primaryname": "Dogecoin",
"primarycode": "DOGE",
"secondaryname": "BitCoin",
"secondarycode": "BTC",
"recenttrades": [
{
"id": "25951364",
"time": "2014-02-24 03:37:59",
"price": "0.00000195",
"quantity": "41345.42127692",
"total": "0.08062357"
},
{
"id": "25951344",
"time": "2014-02-24 03:37:34",
"price": "0.00000194",
"quantity": "469263.63233043",
"total": "0.91037145"
},
{
"id": "25951238",
"time": "2014-02-24 03:36:51",
"price": "0.00000194",
"quantity": "8312.99451077",
"total": "0.01612721"
},
我用下面的代码在jQuery来获取数据
$(document).ready(function() {
var url = "http://pubapi.cryptsy.com/api.php?method=singlemarketdata&marketid=132";
$.getJSON(url,function(data) {
console.log(data);
});
});
我能够得到JSON使用Python,但使用jQuery,我没有得到JSON对象的数据。我缺少什么吗?
总之同源策略 –