title: If statements with jQuery variables in an x-tmpl script
body: <p>so I have a x-tmpl script at the bottom of my page. This script prints out a table of rows for each record in a file. This is part of the script:</p>
  
  <pre><code>&lt;script id="template-download" type="text/x-tmpl"&gt;
  &lt;td&gt;
  
              {% if (file.deleteUrl) { %}
                  &lt;button class="btn btn-danger delete" data-type="{%=file.deleteType%}" data-url="{%=file.deleteUrl%}"{% if (file.deleteWithCredentials) { %} data-xhr-fields='{"withCredentials":true}'{% } %}&gt;
                      &lt;i class="glyphicon glyphicon-trash"&gt;&lt;/i&gt;
                      &lt;span&gt;Delete&lt;/span&gt;
                  &lt;/button&gt;
                  &lt;input type="checkbox" name="delete" value="1" class="toggle"&gt;
              {% } else { %}
                  &lt;button class="btn btn-warning cancel"&gt;
                      &lt;i class="glyphicon glyphicon-ban-circle"&gt;&lt;/i&gt;
                      &lt;span&gt;Cancel&lt;/span&gt;
                  &lt;/button&gt;
              {% } %}
  &lt;/td&gt;
  &lt;/script&gt;
  </code></pre>
  
  <p>I want to check if the variable in my URL (?user=xxx) is not equal to a text value to not show the delete button in the script. The values I am trying to compare are defined in my javascript:</p>
  
  <pre><code>var phpuser = '&lt;?php echo $tuser; ?&gt;'; //where $tuser is the GET variable
  var tusername= $('#myname').text();
  </code></pre>
  
  <p>I have tried to to the following: </p>
  
  <pre><code>&lt;script id="template-download" type="text/x-tmpl"&gt;
  var phpuser = '&lt;?php echo $tuser; ?&gt;';
  var tusername= $('#myname').text();
  
  &lt;td&gt;
          {% if ((file.deleteUrl)  &amp;&amp; (phpuser==tusername)) { %}
              &lt;button class="btn btn-danger delete" data-type="{%=file.deleteType%}" data-url="{%=file.deleteUrl%}"{% if (file.deleteWithCredentials) { %} data-xhr-fields='{"withCredentials":true}'{% } %}&gt;
                  &lt;i class="glyphicon glyphicon-trash"&gt;&lt;/i&gt;
                  &lt;span&gt;Delete&lt;/span&gt;
              &lt;/button&gt;
              &lt;input type="checkbox" name="delete" value="1" class="toggle"&gt;
          {% } else { %}
              &lt;button class="btn btn-warning cancel"&gt;
                  &lt;i class="glyphicon glyphicon-ban-circle"&gt;&lt;/i&gt;
                  &lt;span&gt;Cancel&lt;/span&gt;
              &lt;/button&gt;
          {% } %}
  &lt;/td&gt;
  &lt;/script&gt;
  </code></pre>
  
  <p>However, the console comes up with "phpuser is not defined". Can anyone give any insight please? Cheers.</p>