【发布时间】:2011-09-30 09:29:55
【问题描述】:
我有自己的模板,头部有这段代码:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/jquery-ui.min.js"></script>
<script type="text/javascript" src="{{MEDIA_URL}}emotions.js"></script>
但在 Chrome 代码光谱仪中,我总是有:
Error in event handler for 'undefined': TypeError: Cannot call method 'replace' of undefined
emotions.js:
$(function(){
$('.emotion').click(function(){
var id = $(this).parent().attr('id')
$.post("something/vote/", { emotion: "emotion", id: "id" } )
$('.vote_value').text('You give your vote')});
});
有什么可能出错的建议吗?
【问题讨论】:
-
10:1 故障位于
emotions.js -
会显示什么{{MEDIA_URL}}..?
-
{{MEDIA_URL}} 给出的值是文件emotion.js的url路径
-
您是否尝试过回显 {{MEDIA_URL}}..?可能只需要 {MEDIA_URL}..
-
不,我肯定需要 {{MEDIA_URL}} 并且肯定写得很好。它是 django 特性,上下文变量。
标签: jquery django google-chrome