From 396da8ba20e7f8b8f40ef7305e6eb36e13f9568a Mon Sep 17 00:00:00 2001 From: Sonali Agrawal Date: Sat, 23 Mar 2019 19:05:22 +0530 Subject: [PATCH] Change comment count on comment creation via AJAX #441 This closes issue #441 "Change comment count on comment creation via AJAX #441" by incrementing comments-number each time a new comment is added. This would ensure that the counter indicating the number of comments is increased without needing to refresh the page. --- app/assets/javascripts/maps.js | 1 + 1 file changed, 1 insertion(+) diff --git a/app/assets/javascripts/maps.js b/app/assets/javascripts/maps.js index 291f25edc..ae81e336a 100644 --- a/app/assets/javascripts/maps.js +++ b/app/assets/javascripts/maps.js @@ -58,6 +58,7 @@ jQuery(document).ready(function($) { $("#new_comment textarea").val('')     $("#comments").append(xhr.responseText) + $("#comments-number").text(function(i, str) { return (parseInt(str) + 1); }); $('.comment:last').click(edit_comment).click(delete_comment)   }).on("ajax:error", function(e, xhr, status, error) { if (xhr.responseText == "Login required.") {