php - How to pass the $_SESSION value after using AJAX -
i trying if-statement respond change in $_session['view'] value, after using ajax filter query results. however, if-statement not nested within ajax div section, rather adjacent , below.
what think need, perhaps function within ajax page call reload of if-statement, thereby checking new $_session['view'] value.
this present structure.
<?php session_start(); ?> <body> <div class="content">content here <div class="filters"> <select name="view">view <option value="standard">standard</option> <option value="gallery">gallery</option> </select> </div><!--end filters--> <div class="show"> ajax results here </div> </div> // below displays adjacent div <?php $sess == ($_session['view']) if(!isset($sess)||($sess=='standard')){ echo '<div>standard</div>' } else { switch ($sess) { case 'gallery' : echo '<div>gallery</div>'; } } ?> </body> i have tried initiate refresh following on (external) ajax page;
$prior = $_session['view']; $_session['view'] = $_request['view']; //allows filter set new value $post = $_session['view'] if($prior !== $post){header('location:'.$_server['php_self'].'?refresh=1');} this did not work, because header sent (naturally), but thought !== approach step in right direction.
in second failed attempt, tried adding "refresh-page" code ajax script, reset filters values - defeating point.
$(document).ajaxstop(function(){ window.location.reload(); }); how can ajax (which included via external file) trigger if-statement re-check $_session value?
Comments
Post a Comment