title: MVC4 Razor confused about braces
body: <p>I've got a fairly simple question for all the Razor experts out there.  I'm trying to make a jQuery $.ajax() call to a URL, using Url.Content() to translate the home-relative path into an root-relative path.  In so doing, Razor is getting a bit confused about where the end of my @section is located.  I'd prefer to be able to specify the URL inline, but when I do that, Razor thinks that the end of the $.ajax() parameter list is the end of my @section.  I'm using @section because I want to use layouts to place my javascript at the bottom of each file.  Why is Razor getting so confused?  I've even tried using @(Url.Content(...)), but that doesn't work either.</p>
  
  <p>Also, is this the best way to approach the problem?  I'm using the ASP.NET MVC 4 Preview.</p>
  
  <p><em><strong>This works:</em></strong></p>
  
  <pre><code>@section Scripts {
      &lt;script type="text/javascript"&gt;        
          var getMessagesUrl = '@Url.Content("~/Logging/GetMessages")';
  
          $(document).ready(function () {
              $.ajax({
                  url: getMessagesUrl,
                  dataType: 'html',
                  success: function (result) {
                      $('tbody').html(result);
                  }
              });
          });
      &lt;/script&gt;
  }
  </code></pre>
  
  <p><em><strong>This doesn't:</em></strong></p>
  
  <pre><code>@section Scripts {
      &lt;script type="text/javascript"&gt;        
          $(document).ready(function () {
              $.ajax({
                  url: '@Url.Content("~/Logging/GetMessages")',
                  dataType: 'html',
                  success: function (result) {
                      $('tbody').html(result);
                  }
              }); //Razor thinks this is the curly-brace that ends the section!
          });
      &lt;/script&gt;
  }
  </code></pre>