title: Passing a Javascript variable to Django view
body: <p>I made a JavaScript/jQuery game using that and HTML CSS. Now I am trying to integrate said game into a Django backend. Currently, I have a <code>.js</code> file that contains all of my Javascript/jQuery logic. It is <code>&lt;linked&gt;</code>'ed to the HTML page and basically controls the entire flow of the game. </p>
  
  <p><em>How do I access a JavaScript variable within my <code>.js</code> file in my Django</em></p>
  
  <p><strong><em>.js code...</em></strong><br>
  I want the <code>this.clicks</code> variable to be accessible in my Django view.</p>
  
  <pre><code>this.total = 18
  this.clicks = 0
  this.move = function(num){  //Adds or subtracts one from total depending on which player calls it
      if(this.total == 0){
          $('#oneone').show();
      }else if(this.total == 36){
          $('#twoform').show();
      }else{
          this.total += num
          this.clicks += 1
          return this.total
      }
  }
  </code></pre>
  
  <p><strong><em>Django view...</em></strong></p>
  
  <pre><code>class EndGame(View):
      def get(self, request, victor, gameid, player1id, player2id):
          print(gameid)
          if int(victor) == 1:  ##player one
              self.TallyUpScore(1, player1id, player2id)
              self.UpdateGameStats(1, gameid)
          else:  ##player two
              self.TallyUpScore(2, player1id, player2id)
              self.UpdateGameStats(2, gameid)
          return redirect('/')
  </code></pre>