Advertisement
imjyb1008work

ExtJS Cookie Sample

Dec 31st, 2014
859
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //*************************** Set Cookie ***************************
  2. //Basic
  3. Ext.util.Cookies.set('basic', 10);
  4.  
  5. //expires
  6. var days = 30;
  7. var expires = new Date(new Date().getTime() + (1000 * 60 * 60 * 24 * days));
  8. Ext.util.Cookies.set("expires", 12, expires);
  9.  
  10. //path
  11. var days = 30;
  12. var expires = new Date(new Date().getTime() + (1000 * 60 * 60 * 24 * days));
  13. var path = "/mypath";
  14. Ext.util.Cookies.set("path", 30, expires, path);
  15.  
  16.  
  17. //*************************** Get Cookie ***************************
  18. var value = Ext.util.Cookies.get('basic');
  19. console.log(value);
  20.  
  21. //*************************** Remove Cookie ***************************
  22. Ext.util.Cookies.clear('basic');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement