当我使用这个js库时,如何读取django中的某些数据?
我想使用这个 js Libarry(Tickp) 在 django 中制作股票图表。
我编写模板:
<script type="text/javascript" src="/site_media/stats.js"></script>
<script type="text/javascript" src="/site_media/tkcip.js"></script>
<script>
$(document).ready(function() {
scrips = undefined;
if($.browser.msie) {
if($.browser.version < "9.0") {
var htmlstr = '<h5> Your browser \'IE : ' + $.browser.version + '\' does not support certain HTML 5 features natively, which we use. You won\'t be able to experience the full capabilities without those. Workarouns include - Using <a href="http://code.google.com/chrome/chromeframe/">Google Chrome Frame</a> Plugin. To read more about \'Google Chrome Frame\' plugin, please read the following <a href="http://en.wikipedia.org/wiki/Google_Chrome_Frame"> article on Wikipedia</a>.'
$("#chart").html(htmlstr);
}
}
plot = window.tickp("#chart")
plot.read({{ hisdata }})
plot.plot()
});
</script>
<div id="chart" >
</div>
然后测试 {{hisdata}} 格式,如下所示:
[[734472, 17.579999999999998, 17.649999999999999, 17.309999999999999, 17.5, 14635299], [734472, 17.579999999999998, 17.649999999999999, 17.309999999999999, 17.5, 14635299], [734472, 17.579999999999998, 17.649999999999999, 17.309999999999999, 17.5, 14635299]]
但浏览器中没有任何反应,我的代码有什么问题吗?
I want to use this js Libarry(Tickp) to make a stock chart in django.
and I write the template:
<script type="text/javascript" src="/site_media/stats.js"></script>
<script type="text/javascript" src="/site_media/tkcip.js"></script>
<script>
$(document).ready(function() {
scrips = undefined;
if($.browser.msie) {
if($.browser.version < "9.0") {
var htmlstr = '<h5> Your browser \'IE : ' + $.browser.version + '\' does not support certain HTML 5 features natively, which we use. You won\'t be able to experience the full capabilities without those. Workarouns include - Using <a href="http://code.google.com/chrome/chromeframe/">Google Chrome Frame</a> Plugin. To read more about \'Google Chrome Frame\' plugin, please read the following <a href="http://en.wikipedia.org/wiki/Google_Chrome_Frame"> article on Wikipedia</a>.'
$("#chart").html(htmlstr);
}
}
plot = window.tickp("#chart")
plot.read({{ hisdata }})
plot.plot()
});
</script>
<div id="chart" >
</div>
and I test the {{hisdata}} format like this:
[[734472, 17.579999999999998, 17.649999999999999, 17.309999999999999, 17.5, 14635299], [734472, 17.579999999999998, 17.649999999999999, 17.309999999999999, 17.5, 14635299], [734472, 17.579999999999998, 17.649999999999999, 17.309999999999999, 17.5, 14635299]]
but nothing happen in browser,what's wrong with my code?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当我将 tkcip.js 修复为 tickp.js 时,它起作用了。请使用 webkit 检查器或 firebug 并使用 JSLint 检查 javascript 代码。由于缺少分号,它在 Internet Explorer 中给出语法错误。
我的views.py:
我的core/index.html:
我的application.js是:
It works when i fixed tkcip.js as tickp.js. Please use webkit inspector or firebug and check javascript codes with JSLint. It gives syntax error in Internet explorer because of missing semicolons.
my views.py:
my core/index.html:
and my application.js is: