title: How can I use jQuery to update a field on my rails model?
body: <p>I have a model, Player, that has a field total_points.</p>
  
  <p>On my home page, I have the players name and total_points:</p>
  
  <pre><code>&lt;div id="player1"&gt;
    &lt;h3&gt;&lt;%= "#{@player1.first_name} #{@player1.last_name} (#{@player1.total_points})" %&gt;&lt;/h3&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I would like to have the total_points field on @player1 increase by 1 every time the player's name is clicked by the user. My jQuery (coffeescript) so far is:</p>
  
  <pre><code>/home.js.coffee
  jQuery -&gt;
    pointForPlayer1 = (e) -&gt;
      e.preventDefault()
      console.log('player 1 clicked')
  
    $('#player1').click pointForPlayer1
  </code></pre>
  
  <p>This works (as in, it logs the message to the console), but I'm not sure how to have the click increase @player1.total_points by 1 and then re-render the message above (preferably without reloading the whole page). Thanks!</p>