summaryrefslogtreecommitdiff
path: root/themes/default/js/comment.js
blob: 5d2ed59901ddd4d0d8ff9373b07e448d4266f8ba (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({
    target: "#gCommentForm",
    complete: function(xhr, statusText) {
      ajaxify_comment_form();
      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();
      }
    }
  });
}