Skip to content

Commit

Permalink
Change comment count on comment creation via AJAX publiclab#441
Browse files Browse the repository at this point in the history
This closes issue publiclab#441 "Change comment count on comment creation via AJAX publiclab#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.
  • Loading branch information
sonali9696 authored Mar 23, 2019
1 parent 6a4464f commit 396da8b
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions app/assets/javascripts/maps.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.") {
Expand Down

0 comments on commit 396da8b

Please sign in to comment.