Specifically, comment previewing and posting can optionally use AJAX, as opposed to full HTTP POST requests. This avoids a full-size roundtrip and re-render, so commenting feels faster and more lightweight.
To enable AJAX comments, set the
comment_ajax config parameter in
config.py to True.
disabled or not supported in the user’s browser, or if it doesn’t support
XmlHttpRequest, comment posting and preview will use normal HTTP POST.
Also, since the browser window never sends a full POST request, refreshing the page after a preview or comment submission won’t re-post the comment, or pop up an annoying “are you sure?” dialog box.
AJAX comment support requires a few elements in the comment-form flavour template. Specifically, the comment-anchor tag must be the first thing in the template:
<a name="comment-anchor" id="comment-anchor"></a>
Also, the buttons in the comment form should include these onsubmit and onclick attributes:
<form name="comments_form" ... onsubmit="return false;"> <input value="Preview" name="preview" type="submit" onclick="send_comment('preview');" /> <input value="Submit" name="submit" type="submit" onclick="send_comment('post');" />
Finally, this script tag must be included somewhere after the
All of these tags are included in the default comment-form template that comes with this plugin.