summaryrefslogtreecommitdiff
path: root/themes/default/js/comment.js
blob: 5cb236e8a0deef4e65b7a7dcb5f78717762611c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
$("document").ready(function() {
  ajaxify_comment_form();
});

function ajaxify_comment_form() {
  $("#gCommentForm").ajaxForm({
    complete: function(xhr, statusText) {
      $("#gCommentForm").replaceWith(xhr.responseText);
      if (xhr.status == 201) {
        $.get(xhr.getResponseHeader("Location"), function(data, textStatus) {
		$("#gComment div.gBlockContent ul:first").append(data);
		$("#gComment div.gBlockContent ul:first li:last").hide().slideDown();
	      }
	);
	$("#gCommentForm").clearForm();
      }
      ajaxify_comment_form();
    }
  });
}