title: I want to Pass Django's url to form's action using Javascript
body: <p>I want to do something like below in my Django project</p>
  
  <p>Question : I want to Pass Django's page url to form's action using Javascript</p>
  
  <p>Query: Actually It is working but "How can I pass any argument with this URL" </p>
  
  <p>Working Code: last line of js is working because I am passing custom value i.e. 1</p>
  
  <pre><code>&lt;form id="book_hotel" action="{% url 'payment' hotel.price %}"&gt;
      {% csrf_token %}
          .
          .
          .
  &lt;/form&gt;
  
  &lt;script&gt;
      function calculate() {
          room = document.getElementById('room').value
          night = document.getElementById('night').value
          var hotel_price = "{{ hotel.price }}"
          var total_price = hotel_price*room*night
          document.getElementById('payment_button').innerHTML='Pay &amp;#8377;'+total_price;
          document.getElementById('book_hotel').action = "{% url 'payment' 1 %}"
      }
  &lt;/script&gt;
  </code></pre>
  
  <p>Not Working Code:
  if chang last line of my javascript to given as below</p>
  
  <pre><code>document.getElementById('book_hotel').action = "{% url 'payment' " + total_price + "%}"
  </code></pre>
  
  <p>It is not working.</p>
  
  <p>So How can I pass 'total_price' argument in javascript</p>
  
  <p>I know Question is bit messy so please comment below to get more clarification. </p>
  
  <p>Thank You!!</p>