title: How to Update Cookie Value in Angular js (or) JQuery
body: <p>I am Struck in Updating Cookie Value.Here I am using Angular js for scription.
  and here i need to update existing cookie, but i can't able update that one.</p>
  
  <p>here is my code, Please any one review and suggest me.</p>
  
  <pre><code>$.ajax({
      type : "POST",
      url : appUrl + "/Login",
      data : {
          username : user,
          password : pwd,
          page : "home"
      },
      dataType : 'json',
      success : function(obj) {
          if (obj.direction != "") {
              var myAry = obj.LoginUserDetails[0];
              //alert("The json array is----&gt;&gt;&gt;"+myAry.partnerid);
              setCookie('LoginDetails', JSON.stringify(myAry));
  </code></pre>
  
  <p>And After some operation i get the cookie like this</p>
  
  <pre><code>var storedAry = JSON.parse(getCookie('LoginDetails'));
  </code></pre>
  
  <p>and perform some operations</p>
  
  <pre><code>.ajax({
   url : appUrl+ '/EditPartner',
  data : data1,                                                                                        
  cache : false,                                                          
  contentType : false,
  processData : false,                                                                                                                                       
  type : 'POST',                                                  
  success : function(data) {                                                  
  var txt = data;                                                 
  var obj = eval('('+ txt + ')');                                                 
  
  loginuserdetails = obj.allregdetails[0];// setCookie('LoginDetails',                                                        
  </code></pre>
  
  <p>After using this cookie now i want to update my cookie, for that i followed following procedure</p>
  
  <pre><code>setCookie('LoginDetails', JSON.stringify(myAry));//but not succedd so try below code
  
  
  document.cookie = "LoginDetails"+ "="+ escape(JSON.stringify(loginuserdetails));
  </code></pre>
  
  <p>And after that i tested by getting that cokkie value but not updated</p>
  
  <pre><code>var logindetailsvalues = JSON.parse(getCookie('LoginDetails'));                                                             
  console.log("details after updation----&gt;&gt;"+ getCookie('LoginDetails'));                                                             
  </code></pre>