-2

register session php (in a different file it gets processed):

 $_SESSION['valid_user'] = $cust_email; //register session
 header('Location: ' . $_SERVER['HTTP_REFERER']); //redirect to refering page
 exit;

this session value appears in a div on top of every page:

 <div class="message">
    <?php
    echo "$message";
    ?>  
 </div>

I am trying that this data to be passed to jquery-ajax so that once registered, session variable appears asynchronously in that div. Right now I need to refresh the page

4

1 回答 1

0

你可以创建一个 php 脚本来获取你需要的会话变​​量,如果它不为空(你的逻辑)则回显它。

那么您想使用该 jquery 脚本来更新 div:

function loadLog(){
$.ajax({
url: "getsession.php",  
cache: false,  
success: function(html){    
$(".message").html(html);
}});}
于 2013-08-11T10:37:48.137 回答