SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Addict Shaydez's Avatar
    Join Date
    Jul 2006
    Location
    Boca Raton, Florida
    Posts
    356
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    PHP + JQuery AJAX Call Drops Session

    I'm having a problem trying to keep a session when i send a AJAX called to a file in a sub directory. I figured it was a problem with session create intance in the cookie based on the sub directory so i did the Set Cookie Param.

    PHP Code:
    CreateAccount.php
    ini_set
    ('session.cookie_domain'substr($_SERVER['SERVER_NAME'],strpos($_SERVER['SERVER_NAME'],"."),100));
    session_set_cookie_params(0'/''.domain.com');
    session_start(); 
    Code:
    						$.ajax({
    						  url: "/user_signup.php",
    						  type: "post",
    						  data: values,
    						  success: function(){
    							  window.location.reload(true);   // Reloads the window to force the session to show in current page. 
    						  },
    						  error:function(){
    							  alert("failure");
    						  }   
    						});
    It works perfect went i put the CreateAccount in the root directory.. however just for my sanity (OCD Issues) i prefer the CreateAccount to go into /ajax/CreateAccount.php lol
    Sr. Website Developer and Internet Marketing
    www.CarlosJa.com Note: If anyone
    needs to get ahold of me please feel free to email me through
    my site. Apparently i missed quite a few private messages.

  2. #2
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    73 Post(s)
    Tagged
    0 Thread(s)
    Your ajax call isnt calling for CreateAccount.php ? it's calling for /user_signup.php ...
    Never grow up. The instant you do, you lose all ability to imagine great things, for fear of reality crashing in.


Bookmarks

Posting Permissions

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