I am trying to send data from one php file to another php file with sessions. Using ajax to refresh both scripts at same time on my main page.
One php script picks random picture from folder and displays it on main page, now I am trying to add report function that is in separated.
Now in file that is getting random picture I am doing
session_start();
$_SESSION['userName'] = 'Root';
$images[$i];
$_SESSION['picture'] = $images[$i];
and in my report.php I have
session_start();
$picturepath = $_SESSION['picture'];
echo $picturepath;
I am calling them like this in my mainfile.html
function Refresh()
{
$('#picturehere').load('getRandom.php')
$('#report').load('report.php')
};
Now the problem is, every time I execute that function, my report.php stores value from previous picture. But if I do ctrl + f5, the value will be from current picture.
Is there any way around this?
Example:
First refresh:
picture url: picture1.png
session value: picture1.png
Now calling Refresh function
picture url: picture2.png
session value: picture1.png
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…