0
点赞
收藏
分享

微信扫一扫

ajax is not defined异常解决


首先这个异常是在前端页面展示出来的,可以采用浏览器的开发者模式,进行查看显示时候的异常。

这个异常不清楚有没有其他的出现情况:

我的只是因为,在ajax模板中没有加入$,哎,本屌人生中的一大败笔啊。


$.ajax({
type: "post",
url: "${pageContext.request.contextPath}/**",
data: {username:$("#username").val()},//需要传递的参数
dataType: "json",//数据响应格式
success: function(data){
$('#resText').empty(); //清空resText里面的所有内容
var html = '';
$.each(data, function(commentIndex, comment){
html += '<div class="comment"><h6>' + comment['username']
+ ':</h6><p class="para"' + comment['content']
+ '</p></div>';
});
$('#resText').html(html);
}
});


举报

相关推荐

0 条评论