Cannot access cookie in javascript
<p>I created a function to get the cookie in javascript :</p>

<pre><code>   function getCookie() {
        var arr = document.cookie.split(";");
        for (i = 0; i &lt; arr.length; i++) {
            if (arr[i].substr(0, arr[i].indexOf("=")).replace(/^\s+|\s+$/g, "") == "taxibleC") {
                return arr[i].substr(arr[i].indexOf("=") + 1);
            }
        }
    }
    var multipleVAT = 1;
</code></pre>

<p>And then I have another function to initialize the cookie :</p>

<pre><code>  function ChangeVATValue() 
   {
      if ($("#vatEnable").is(':checked')) {
         multipleVAT = 1;
      } else {
         multipleVAT = 0;
      }
      document.cookie = "taxibleC=" + multipleVAT;
      alert(getCookie());
   }
</code></pre>

<p>When I used <code>alert(getCookie());</code>, It has the value 1.
But when I click to another page, the alert is 0. </p>

<p>Could anyone tell me, why I cannot access the session by using the <code>getCookie()</code> method in the view of my asp.net MVC 3.0 project.</p>
