Passing PHP session variable to AJAX URL
        Posted  
        
            by 
                user547794
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by user547794
        
        
        
        Published on 2010-12-27T19:36:41Z
        Indexed on 
            2010/12/27
            19:54 UTC
        
        
        Read the original article
        Hit count: 234
        
Hello,
I am trying to pass a session variable into an AJAX loaded page. Here is the code I am using:
 jQuery(document).ready(function(){
$("#userdetail").click(function() {
  $.ajax({
   url: "userdetail.php?id=<?php $_SESSION['uid']?>",
   success: function(msg){
     $("#results").html(msg);
   }
 });
});
});
This is the HTML URL I had working, not sure how to get this into the AJAX call:
userdetail.php?id=<?php $_SESSION['uid']?>
I should also mention that if I manually pass in the userID it works fine
url: "userdetail.php?id=1",
© Stack Overflow or respective owner