ajax is not defined异常解决
发布时间:2020-12-16 03:28:27 所属栏目:百科 来源:网络整理
导读:首先这个异常是在前端页面展示出来的,可以采用浏览器的开发者模式,进行查看显示时候的异常。 这个异常不清楚有没有其他的出现情况: 我的只是因为,在ajax模板中没有加入$,哎,本屌人生中的一大败笔
首先这个异常是在前端页面展示出来的,可以采用浏览器的开发者模式,进行查看显示时候的异常。 这个异常不清楚有没有其他的出现情况: 我的只是因为,在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); } }); (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |