详情页面增加评论功能
一个评论盖楼demo:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style media="screen">
.comment {
border:1px solid #ccc;
padding:10px;
margin:2px
}
</style>
</head>
<body>
<div class="comment">
你喜欢我吗
<div class="comment">
喜欢
<div class="comment">
不喜欢
</div>
</div>
</div>
</body>
</html>
mongodb数据库结构
<script>
function getDiscuss(){ $.ajax({
url:'http://192.168.20.222:3000/admin/getDiscuss',
data:{gid:goodsID},
dataType:'json',
type:'post',
success:function(data){
var c=data;
var a='<div class="commentsinfo">';
var b='<p class="theauthor">';
var h='</p><span class="commentsnumber">';
var d='</span><p>'; var e='</p></div>';
var g='<div class="comments">';
var str=''; for (var i = 0; i < c.length; i++) {
var xstr=''; var x=c[i]._contents;
}
}
})
}
</script>