title: Embedding C# code using <%= code %> within javascript <script> tags
body: <p>I'm using ASP.NET MVC and would like to get Model information for use within my javascript. I've strongly typed the view, and thus am able to use <code>&lt;%= Model.Name %&gt;</code> within my HTML to get Model data.</p>
  
  <p>But once I'm in the <code>&lt;script&gt;</code> tags, I get no intellisense (in Visual Studio) when using &lt;%, and the information doesn't seem to be rendering properly. Is there something I'm missing to be able to use the angle bracket scheme within Javascript?</p>
  
  <p>Thanks.</p>
  
  <p><strong>CLARIFICATION:</strong> I should have posted the code I'm trying to use the first time around. To elaborate a bit more, I'm trying to use JQuery's $.getJSON to get data from the Model (via the Controller), and populate a JSON object. The javascript I'm using is below:</p>
  
  <pre><code>    &lt;script type="text/javascript"&gt;
      $(document).ready(function() {
          $.getJSON("&lt;%=Url.Action("PopulateJournalOptions", "Evaluation", Model.ID) %&gt;", populateJSON);
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>PopulateJournalOptions is my Controller Action, Evaluation is my Controller Name, and Model.ID is what I'm trying to pass to it. Incidentally, I should be able to achieve the same thing using:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      $(document).ready(function() {
          $.getJSON("/Evaluation/PopulateJournalOptions/&lt;%= Model.ID %&gt;", populateJSON);
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>But even here, I'm not sure those angle brackets are being used correctly. It definitely looks a bit off. Thanks for the help.</p>
  
  <p><strong>UDPATE:</strong> Went ahead and tried the second method above and it does indeed work. I'm still having trouble using the first method that uses Url.Action(), which is a shame because I think it's the better method. But the &lt;% tags are definitely rendering data now. I guess it just threw me when there was no intellisense and they didn't highlight like normal. Thanks for the quick responses. Any ideas on the right format for the first option above?</p>