Forums

[resolved] [Plugin: Ajax Comment Posting] duplicate script loading bug fix (1 post)

  1. vonkanehoffen
    Member
    Posted 2 years ago #

    Just a note to say thanks for the plugin and here's (maybe) a bug fix for you:

    I had trouble with the plugin reloading other scripts on the page once it received it's response from wp-comments-post.php
    This was because wp-comments-post.php spits back an entire wordpress page, complete with headers and footers, and the jquery parses it:

    var response = $("<ol>").html(data);

    to get round this, I changed that line to:

    comment_response = data.split('<!-- BEGIN: COMMENTS -->');
    comment_response = comment_response[1].split('<!-- END: COMMENTS -->');
    var response = $("<ol>").html(comment_response[0]);

    and put <!-- BEGIN: COMMENTS --> and <!-- END: COMMENTS --> at either end of comments.php in my template. Worked fine and stopped a lot of weird behaviour!

    Yes, I am aware there are probably far elegant solutions, but I hope that helps someone out there :-)
    http://wordpress.org/extend/plugins/ajax-comment-posting/

Topic Closed

This topic has been closed to new replies.

About this Topic