title: Razor RenderSection within script tags - How to insert script from view into template function
body: <p>I'm using MVC 3 with the Razor view engine and I would like to inject scripts from multiple views into one centrally defined <code>$(document).ready();</code> function in the master page.</p>
  
  <p>I have tried the following:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      $(document).ready(function () {
        //OnLoad Script load area
        '@RenderSection("DocumentReady", false)'
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>In my master view, and then:</p>
  
  <pre><code>@section DocumentReady{
      alert('Document is ready!');
  }
  </code></pre>
  
  <p>In my view, but unsuprisingly, we get compilation errors due to the javascript not being within a <code>&lt;script&gt;</code> tag.</p>
  
  <p>If there are a lot of small view controls that need to run some initialisation script in the <code>$(document).ready()</code> function, it would be nice to keep them all together in a single place.</p>
  
  <p>Is there a way to inject javascript to a master view without the surrounding <code>&lt;script&gt;</code> tags and without affecting compilation?</p>