title: How to declare global variable in html and javascript
body: <p>How can I declare a global variable in html and javascript for a django template page. I want to make display_language to be a global variables.</p>
  
  <pre><code>&lt;script&gt;
    function onChange(){
      if (xmlHttp.readyState==4 &amp;&amp; xmlHttp.status==200) {
          //request is successful. So retrieve the values in the response
          display_language = xmlHttp.responseText.split(';');
          alert("response: " + display_language);
     }
  }
   &lt;/script&gt;
  </code></pre>
  
  <hr>
  
  <pre><code>&lt;html&gt;
    &lt;body&gt;
       {% ifequal item.lang display_language %}
             {{item.text.strip}}
       {% endifequal %}
     &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>