【发布时间】:2015-05-05 19:24:00
【问题描述】:
(使用 Google Traductor 翻译) 嗨,我正在学习 javascript,我正在尝试模拟 yahoo Finance 页面上股票报价发生的变化。
我正在阅读来自 stackoverflow 页面的许多回复,我这样做了。
http://js.do/code/53880 如果您使用的是谷歌浏览器,大约一分钟后会出现控制台错误。 Control -Shift -J(控制台选项卡/错误)
错误: net::ERR_INSUFFICIENT_RESOURCESjquery-1.9.1.js:8336 sendjquery-1.9.1.js:7978 jQuery.extend.ajaxVM8678:12 更新
页面也有延迟
$(function(){
$(function() {
setInterval(update, 0);
});
function update() {
var query = "select * from yahoo.finance.quotes where symbol = ";
var symbolo = "'AAPL'";
var yql = "http://query.yahooapis.com/v1/public/yql?q=" + escape(query+symbolo) + "&format=json&diagnostics=true&env=store://datatables.org/alltableswithkeys&callback=?";
var xhr2 = $.ajax({
url: yql,
jsonp: "myCallback",
dataType: 'jsonp',
success: function(data) {
var keys = data.query.results.quote;
$("#a").html(keys.LastTradePriceOnly);
},
error: function (xhr, ajaxOptions, thrownError) {
alert("oth1"+xhr.statusText);
alert("oth2"+xhr.responseText);
alert("oth3"+xhr.status);
alert("oth4"+thrownError);
}
});
}
});
【问题讨论】:
标签: javascript json callback jsonp yql