[英]What am I doing wrong with this javascript?
I want this simple javascript to display live data from the Cryptsy market. 我希望这个简单的javascript显示来自Cryptsy市场的实时数据。 In the fiddle, it works fine, but when I deploy it live, it does not display.
在小提琴中,它可以正常工作,但是当我实时部署它时,它不会显示。 I'm new to javascript and coding-beyond-html in general, so I'll greatly appreciate any help!
我一般都不是javascript和encoding-beyond-html的新手,所以我将不胜感激!
Deployed: http://bytillionaire.com/HTMLCoin.com/index.html 部署: http : //bytillionaire.com/HTMLCoin.com/index.html
Fiddle: http://jsfiddle.net/bitillionaire/5fub4mvf/2/ 小提琴: http : //jsfiddle.net/bitillionaire/5fub4mvf/2/
code here: 代码在这里:
<head>
<script type='text/javascript'>
//<![CDATA[
$(window).load(function() {
$(function() {
startRefresh();
});
function startRefresh() {
setTimeout(startRefresh, 10000);
var url = 'http://pubapi.cryptsy.com/api.php?method=singlemarketdata&marketid=458';
$.getJSON('http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20json%20where%20url%3D%22' + encodeURIComponent(url) + '%22&format=json', function(data) {
jQuery('#ticker').html(data['query'].results.json.return.markets.HTML5.lasttradeprice);
jQuery('#ticker').append(' ' + data['query'].results.json.return.markets.HTML5.secondarycode);
});
}
}); //]]>
</script>
</head>
<body>
<div id="navigation">
<a href="https://twitter.com/htmlcoin" class="twitter-follow-button" data-show-count="false" data-show-screen-name="false">Follow @htmlcoin</a>
<script>
! function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0],
p = /^http:/.test(d.location) ? 'http' : 'https';
if (!d.getElementById(id)) {
js = d.createElement(s);
js.id = id;
js.src = p + '://platform.twitter.com/widgets.js';
fjs.parentNode.insertBefore(js, fjs);
}
}(document, 'script', 'twitter-wjs');
</script>
<div id="ticker"></div>
</div>
</body>
PS -- if you put your HTMLCOIN address, I will pay you 25,000 coins if your answer is the first one to solve the problem. PS-如果您输入HTMLCOIN地址,如果您的答案是解决问题的第一个答案,我将向您支付25,000个硬币。 :)
:)
我在控制台Uncaught ReferenceError: $ is not defined
中的站点上看到一个错误Uncaught ReferenceError: $ is not defined
它看起来像jQuery未定义
您尚未在页面上包含jQuery!
Make sure to always have a copy of jquery.js in your javascript folder and to call it! 确保在您的javascript文件夹中始终有一个jquery.js副本并进行调用!
In 在
<script src="js/jquery.js"></script>
This will ensure that jquery functions are able to run. 这将确保jquery函数能够运行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.