Firebug在抱怨这行代码:
$("#original-description").text(response['course']['original_description']).hide();
我是否有语法错误?在我看来一切正常。
更多上下文:
bindOnSuccess($('#course-search'), function(response) {
if (!response) {
$("#system-status").text("Sorry, no course could be found for that search.");
}
else {
$(".dept-code").text(response['course']['dept_code']);
$(".course-number").text(response['course']['number']);
$(".course-title").text(response['course']['title']);
$("#div-original-description").show();
$("#original-description-teaser").show();
// error here
$("#original-description").text(response['course']['original_description']).hide();
$("#td-required-for").text(response['analysis']['cRequiredFor']);
}
});
response
是一个 JSON 对象。这个问题可能是由于无效的下标引起的吗?
Firebug 的错误信息为:
$("#original-description").text(response.course.original_description).hide is not a function