Pass $ _SESSION in load () jquery

-1

I would like to know if it is possible to pass $_SESSION to load() of jquery.

I have a page, where I call by load another, but I need to get the value of $_SESSION on the second page, but it is not working, hence my question is, can it be $_SESSION load() because by $.post() worked.

PAGE 1:

<?php
    session_start();
    $_SESSION['id'] = 1;
?>

$(document).ready(function(){
    $("#retorno").load("pagina1.php");
})

PAGE 2:

<?php
    session_start();

?>
<div class="teste">
    <?php echo $_SESSION['id']; ?>
</div>

I did something similar in my script and it did not work, all files are in UTF-8 sem BOM .

  

Possible is, I used the plugin EditThisCookie , and I could check the   error, on a given page it created the session cookie with a name   different, so when I called on the other side I could not get the session because the cookie had a different name.

    
asked by anonymous 27.08.2016 / 01:21

1 answer

0

If the pages are in the same domain, put load it also works and I did a local test here and it's ok.

    
27.08.2016 / 01:43