title: Use my own c# variable in jquery
body: <p>how can I use my own c#(MVC5, ASP.NET 4.5.1) variable in jquery  ?  Something like that:</p>
  
  <pre><code>  $(function () {
  
          @if (Model != null &amp;&amp; Model.Count() &gt; 0){
              int carrier = Model.Count;
  
          }
          if (location.hash = "#DHLNational") {
              $("#faq-cat-1-sub-0").show(800);
              alert(@carrier);
          }
      });
  </code></pre>
  
  <p>I get the following error message:</p>
  
  <blockquote>
    <p>Error 8   "The name 'carrier' does not exist in the current context"</p>
  </blockquote>
  
  <p>Ok, but if I do it like this:</p>
  
  <pre><code>    $(function () {
  
          @if (Model != null &amp;&amp; Model.Count() &gt; 0){
        int carrier = Model.Count;
  
        if (location.hash = "#DHLNational") {
            $("#faq-cat-1-sub-0").show(800);
            alert(@carrier);
        }
    }
      });
  </code></pre>
  
  <p>Visual studio does not understand jquery anymore.
  Thanks...</p>