title: How can I access a Grails variable in JavaScript?
body: <p>I have a variable in my Grails app’s <code>BootStrap.groovy</code>:</p>
  
  <pre><code>      class BootStrap {
        def init = { servletContext -&gt;
        def testGrails = "11"
  </code></pre>
  
  <p>I want to show a JavaScript <code>alert()</code> if this test value is 11.</p>
  
  <p>My JavaScript:</p>
  
  <pre><code>           &lt;SCRIPT LANGUAGE="JavaScript"&gt;
             if(testGrails==11)   // WHAT TO WRITE WITH IN THE BRACKETS ...?
             {
                 alert("yes");
             }        
  </code></pre>
  
  <p>How can I access a Grails class in Javascript to do the above?</p>
  
  <p>Thanks.</p>