PHP Session data lost on first reload with jquery load() -
PHP Session data lost on first reload with jquery load() -
i'm loading content div jquery's load() function , refresh div every 15 seconds (it checks status).
for reason after first reload / refresh of div, session info lost.
the exact code i'm using long, basic version of i'm doing this:
load.php
<?php session_start(); $_session['testvalue'] = "testvalue"; ?> <div id="loaddiv"></div> <script src="js/jquery.js"></script> <script> (function($) { $(document).ready(function() { $.ajaxsetup( { cache: false, }); var $container = $("#loaddiv"); $container.load("load_test.php"); var refreshid = setinterval(function() { $container.load('load_test.php'); }, 10000); }); })(jquery); </script>
load_test.php
<?php session_start(); echo $_session['testvalue']; ?>
works fine when page loads initally , displays testvalue, after div refreshs there no more output however.
anyone experienced before , knows what's going on ?
//edit
i'm 1 step farther solving this:
on main page i'm selecting things mysql db , putting session, in subpage (the 1 jquery load() loads ) outputting session values.
there's absolutely nil on subpage this:
<?php session_start(); echo $_session['test_one']; echo $_session['test_two']; ?> <?php echo session_id(); ?>
when jquery load() triggered sec time, values in $_session['test_one'];
, $_session['test_two'];
alter ... (it running mysql query 1 time again , putting else session)
the values session set on mainpage, why refreshing subpage run mysql query on main page 1 time again ?!
php jquery session
Comments
Post a Comment