Below is a script that (should) display a list of comments through AJax after a comment was posted.
After an user enters a comment and submits it using AJax, a list of comments with the new comment should be displayed. However, the first page of comments (without the new comment) is always displayed. I want the last page (with the new comment) to be displayed.
Here’s the code:
[CODE]function (c) {
var i = jQuery(“<div />”).plainHtml(c);
$comm = i.find(“#comments-wrap”).plainHtml();
jQuery(“ul#comments #cancel-reply”).hide();
jQuery(“ul#comments”).find(“#respond”).prependTo(“#section-comments”);
jQuery(“#comments-wrap”).plainHtml($comm);
d.empty();
d.attr(“class”, “success”).plainHtml($lang[1]);
jQuery(“#comment”).val(“”);
jQuery(“#submit”).val($lang[2]);
jQuery(“#submit, #comment”).removeAttr(“disabled”);
jQuery(“#comment_parent”).attr(“value”, “0”)
}
I’m not very good at Javascript/JQuery, can someone explain to me exactly what happens with this script?