【发布时间】:2014-08-27 18:06:25
【问题描述】:
我想添加一条评论并立即使用 ajax 在线程中显示它
这是我的代码:
JSP:
<div class="comments">
//Here i show the list of comments
<logic:iterate id="comment" name="discussion" property="comments">
<div class='comment'>
<div class='title'> ${comment.author.firstName}<br>
${comment.date}</div>
<div class='commentContent'>
${comment.content}
</div>
</div>
</logic:iterate>
</div>
//this is my comment form
<html:form action="/sauvegarderCommentaire.do" styleId="formComment">
<label>Ecrire un commentaire:</label>
<br>
<textarea name="comment"> </textarea>
<input type="submit" name="submit" id="submitComment" />
</html:form>
jquery:
$("#submitComment").click(
function() {
$("#formComment").ajaxSubmit({
error : function() {
alert("Il y a une erreur AJAX");
},
success: function(e) {
//Here I try to reload only the comments part of my page
$(".comments").load("/myApp/discussion.do .comments");
}
});
});
希望我说清楚了?!! 否则我可以提供更多细节:)
【问题讨论】:
-
您遇到的错误是什么?
-
完全没有错误,只是没有显示刚刚发布的人的评论!