Results 1 to 2 of 2

Thread: Setting cookie

  1. #1

    Default Setting cookie

    How i can set cookie in this code
    onSuccess:function(form, action) {
    Ext.util.Cookies.set("userId", 1);
    Login.win.hide();} // onSuccess FINISH
    using this json-response
    {"success":true,"user":{"email":1,"firstName":"vasya","id":1,"lastName":"pupkin","login":"vasya","password":"qwe"}}
    I want to set userId to user.id from response

  2. #2
    Ext JS Premium Member prophet's Avatar
    Join Date
    Mar 2007
    Location
    Greenwich, CT
    Posts
    189

    Default

    Depending on the rest of your code, you may or may not need to decode the JSON response from the server. Ext.decode() will do that for you.

    You could probably just use:
    Code:
    Ext.util.Cookies.set("userId", action.result.user.id)

Similar Threads

  1. Setting and retrieving cookie for user that is logged in
    By oshannon in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 15 Jun 2009, 5:56 AM
  2. how to : creating, setting and getting cookie/values?
    By bcamp1973 in forum Ext 2.x: Help & Discussion
    Replies: 10
    Last Post: 17 Mar 2008, 3:21 AM
  3. make cookie expire or delete cookie in EXT
    By mxu in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 25 Jan 2008, 11:49 PM
  4. Request: Example Page Cookie expire setting
    By MarkT in forum Community Discussion
    Replies: 0
    Last Post: 7 Jun 2007, 2:47 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •