title: How to make a separate withdrawal of the rating sum from the button in js?
body: <p>due to not knowing js, I cannot make it work and update when the button is clicked (one of the reactions)
  just one counter, not built into the button. As I understand it, the fault is $ (this) in the function. But what way is there writing to change the counter of the amount of rating between the buttons? This code is added to 9 more posts in addition to this.</p>
  <pre><code>         &lt;button class=&quot;btn-like-up&quot; data-id=&quot;{{ post.id }}&quot; type=&quot;button&quot; data-type=&quot;file&quot; data-action=&quot;rate_up&quot;&gt;
               &lt;i class=&quot;bi bi-chevron-up&quot;&gt;&lt;/i&gt;
           &lt;/button&gt;
              &lt;!-- COUNTER --&gt; 
           &lt;span data-count=&quot;total_rating&quot;&gt;{{ post.total_rating }}&lt;/span&gt;
            &lt;!-- / COUNTER --&gt; 
            &lt;button class=&quot;btn-like-down&quot; data-id=&quot;{{ post.id }}&quot; type=&quot;button&quot; data-type=&quot;file&quot; data-action=&quot;rate_down&quot;&gt;
               &lt;i class=&quot;bi bi-chevron-down&quot;&gt;&lt;/i&gt;
                &lt;span data-count=&quot;total_rating&quot;&gt;{{ post.total_rating }}&lt;/span&gt;
           &lt;/button&gt;
           
  </code></pre>
  <p>When it is alone, it does not update the rating digit when clicked.</p>
  <pre><code>    $('.btn-like.up').submit('click', function(e) {
      e.preventDefault()
      let ratingBox = $(this).data('id')
      let postType = ratingBox.data('type')
      let postId = ratingBox.data('id')
      let postAction = ratingBox.data('action')
      let totalRating = ratingBox.find('[data-count=&quot;total_rating&quot;]')
  
      $.ajax({
          type: 'POST',
          url: '/system/' + postType + '/' + postId + '/' + postAction + '/',
          data: {
              'post_id': postId,
              'csrfmiddlewaretoken': csrftoken
          },
          success: function(response) {
              totalRating.text(response.total_rating);
          },
          error: function(error) {
              console.log(error);
          },
      })
  })
  
  $('.btn-like.down').submit('click', function(e) {
      e.preventDefault()
      let ratingBox = $(this).data('id')
      let postType = ratingBox.data('type')
      let postId = ratingBox.data('id')
      let postAction = ratingBox.data('action')
      let totalRating = ratingBox.find('[data-count=&quot;total_rating&quot;]')
  
      $.ajax({
          type: 'POST',
          url: '/system/' + postType + '/' + postId + '/' + postAction + '/',
          data: {
              'post_id': postId,
              'csrfmiddlewaretoken': csrftoken
          },
          success: function(response) {
              console.log(response)
              totalRating.text(response.total_rating);
          },
          error: function(error) {
              console.log(error);
          },
      })
  })
  </code></pre>