我的文章评论html代码是
<form id="commentForm" action="${base}/comment.jspx" method="post">
<div style="width:100%;height:100%;">
<textarea name="text" class="cinput" cols="100" rows="7"></textarea>
</div>
<div style="margin:5px auto auto 0;width:120px;height:35px;">
<input type="text" name="captcha" style="width:80px;height:25px;" id="captcha" vld="{required:true}" class="plcode"/>
<img id="commentCaptcha" src="${base}/captcha.svl" onclick="this.src='${base}/captcha.svl?d='+new Date()" style="margin:-33px 90px;"/>
<div style="margin:10px;position:absolute;left:47%;">
<input type="submit" name="Submit" value="" class="published" style="background:url(/${res}/img/guestbook/gb-button.gif);width:118px;height:32px;border:none;cursor:pointer;"/>
<input type="hidden" name="contentId" value="${content.id}"/>
</div>
</div>
</form>
js代码:
$(function() {
Cms.attachment("${base}","${content.id}","${content.attachments?size}","attach");
Cms.viewCount("${base}","${content.id}");
Cms.siteFlow("${base}", location.href, document.referrer);
Cms.collectexist("${base}","${content.id}","cancelSpan","comfirmSpan");
$("#comfirmSpan").click(function(){
Cms.collect("${base}","${content.id}",1,"cancelSpan","comfirmSpan");
});
$("#cancelSpan").click(function(){
Cms.collect("${base}","${content.id}",0,"cancelSpan","comfirmSpan");
});
});
$(function() {
/*
$("#commentForm").validate( {
submitHandler : function(form) {
$(form).ajaxSubmit( {
"success" : function(data) {
if(data.success) {
alert("评论成功");
location.href=location.href;
} else {
alert("评论失败");
}
},
"dataType" : "json"
});
}
});
*/
Cms.comment(function(data) {
if(data.status==0) {
alert("评论成功,审核后才显示!");
location.href=location.href;
} else if(data.status==1) {
alert("验证码错误");
$("#commentCaptcha").click();
} else if(data.status==2) {
alert("内容不存在");
$("#commentCaptcha").click();
} else if(data.status==3) {
alert("评论关闭");
$("#commentCaptcha").click();
} else if(data.status==4) {
alert("需要登录评论");
$("#commentCaptcha").click();
}else if(data.status==5) {
alert("已经评论过,不能重复评论");
$("#commentCaptcha").click();
} else if(data.status==100) {
alert("内容不存在");
$("#commentCaptcha").click();
} else if(data.status==101) {
alert("评论不能为空");
$("#commentCaptcha").click();
} else {
alert("评论失败");
$("#commentCaptcha").click();
}
});
});
也不知道哪里出错,点击提交后总是跳到一个只有
{"status":5,"success":false}
的空白页 |
|