title: django template cannot call javascript
body: <p>I have the following django template and I have defined a button in it so that it calls the javascript function which I added to the page like below. I have the below issues:</p>
  
  <p>1) If I bring the script tags to the header section nothings shows up.</p>
  
  <p>2) If press the button I get the undefined error message. (Uncaught ReferenceError: postData).</p>
  
  <p>What am I mssing here?</p>
  
  <p>Thank you very much,
  Mike</p>
  
  <p><strong>newproduct.html</strong></p>
  
  <pre><code>{% load staticfiles %}
  &lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  
  
  
  
  
  &lt;title&gt;New Product&lt;/title&gt;
  &lt;/head&gt;  
  &lt;body&gt;
  &lt;p&gt;Hellow&lt;/p&gt;
  &lt;a href="/"&gt;Back&lt;/a&gt;
  
      &lt;h2&gt;Please enter product details:&lt;/h2&gt;
      &lt;button onclick="postData();"&gt;Send Post&lt;/button&gt;
  
  
  &lt;form action="http://127.0.0.1:8000/newproduct/" method="post"&gt;
      &lt;p&gt;{{ message }}&lt;/p&gt;
          {% csrf_token %}
          {{ form.as_p }}
  
      &lt;input type="submit"/&gt;
  &lt;/form&gt;
  
  
  &lt;script src="bower_components/jquery/src/jquery.js" type="text/javascript"/&gt;
  &lt;script src="scripts/main.js" /&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>main.js</strong></p>
  
  <pre><code>function postData ()
  {
      $.post('/newproduct', {name:'New Product JS', price:555, });
  };
  </code></pre>