Skip to content

Commit

Permalink
Change comment count on comment creation via AJAX #441 (#443)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sonali9696 authored and icarito committed Apr 7, 2019
1 parent 5c640d6 commit a635bde
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 a635bde

Please sign in to comment.