My main file is:
<?php
session_start();
$_SESSION["foo"]="foo";
?>
$.ajax({
type: "POST",
url: "hoho2.php",
});
And my hoho2.php is:
<?php
session_start();
print_r($_SESSION);
?>
Now, In my main file, where I am doing the print_r
, I get the correct session data - foo -> foo
. But in my hoho2.php file, I get the empty array.
Why is session not passing through ajax call?
Is it possible because I have Set-Cookie: HttpOnly:Secure ?
Update: I have figured out that It indeed it because of HttpOnly:Secure that my session is not persisted. What can I do ?