我有以下API如下它返回JSON數據:從使用jQuery或web服務讀取JSON數據C#
API:http://data.mtgox.com/api/1/BTCUSD/ticker
JSON:{"result":"success","return":{"high":
.......
使用jquery我嘗試了以下,但它沒有給我的數據。
$.getJSON('http://data.mtgox.com/api/1/BTCUSD/ticker', function (data) {
alert(data);
});
和
$.ajax({
type: 'GET',
url: 'http://data.mtgox.com/api/1/BTCUSD/ticker',
dataType: 'json',
success: function (data) {
alert(data);
},
error: function (error) {
alert(error + "error");
}
});
但第一我沒有得到任何警告
和第二我得到錯誤警報。
如何使用jQUERY或C#讀取此數據?
THanks
可能是由於相同的原產地政策。你和你要求的數據在同一個域上嗎? – Archer 2013-03-13 11:44:36
第二個錯誤信息是什麼? – Davos555 2013-03-13 11:45:15
試試這個[link](http://stackoverflow.com/questions/15359949/call-webservices-from-javascript-without-using-scriptmanager-in-asp-net) – 2013-03-13 11:45:37