Using Session Variables inside an ajax document
Posted
by Pete Herbert Penito
on Stack Overflow
See other posts from Stack Overflow
or by Pete Herbert Penito
Published on 2010-05-18T05:15:08Z
Indexed on
2010/05/18
5:20 UTC
Read the original article
Hit count: 259
Hi,
For some reason I've having problems reading this session variable within an ajax document, I've got this inside online.php:
` session_start();
if (isset($_SESSION['username'])) { $username = $_SESSION['username']; } `
For some Reason this is not setting username even when the session var is being used on the host page, i call on the php file every second using this
` $(document).ready(function() {
var refreshId = setInterval(function() { $('#timeval').load('online.php'); }, 1000);
$("#stop").click(function() { clearInterval(refreshId); }); }); `
Am I doing something wrong, or is this not even possible?? Any advice would really help thanks alot!
© Stack Overflow or respective owner