I want to do an ajax call in a php file. (the final goal is to get a localStorage). If I have well understood i begin with a start session in the php.
<?php
session_start();
?>
Then, ajax call of another php file.
<script>
src="jquery.js";
var variableToSend = 'foo';
$.ajax({
type: "post",
async : false,
url: "/login_getStorage.php",
data: { variable: variableToSend }
});
</script>
In this file php login_getStorage.php I have only
<?php
$_SESSION['toto'] = "titi";
If I have well understood, the variable $_SESSION['toto'] should be initialized everywere with "titi"
So in the main file :(so after script)
<?php
echo($_SESSION['toto'] );
I thought it will display 'titi'. But I have the error PHP Notice: Undefined index: toto
It seems that my ajax call is not done
How can we do to do this ajax call ?
Best regards.