Tôi đang cố đăng nhận xét bằng bài đăng AJAX. Nhưng phần tử comment
mới nhất chứa nút gửi. Và sau khi thêm, mục mới sẽ xuất hiện sau khi gửi nút.Nối phần tử không kết thúc, trước phần tử cuối cùng trong jQuery
<div class="commentContainer" >
<div class="comment">
<div class="commentText">Any comment1 ... </div>
</div>
<div class="comment">
<div class="commentText">Any comment2 ... </div>
</div>
....................................
<div class="comment">
<div class="sendPanel">
<input type="submit" value="Post" />
</div>
</div>
</div>
và kết quả của việc đăng yêu cầu:
success: function (result) {
if (result.success) {
$('.commentContainer').append('<div class="comment"><div class="commentText">' + result.text + '</div></div>');
}
}
tôi muốn giữ nút gửi vào cuối luôn. Tôi có thể làm cái này như thế nào?
Cảm ơn tất cả sự giúp đỡ. –