How to Use in jQuery the PHP session variable set by Ajax.
As for two general PHP files, no big deal to use the session variable if 'session_start()' is declared at the top.
session_start();
$_SESSION['name'];
---------------------------------------
But in jQuery, how should I use the session in index.php?
The var name doesn't work at the end of codes.
[index.php]-------------------------------------------------------------------------------------
<?php
session_start();
}
?>
<!DOCTYPE html>
<html>
<head>
bla bla
<script type="text/javascript">
$(document).ready(function () {
$('#login').click(function(){
bla bla~
$.ajax({
type: 'POST',
url: '
signin_process.php', /
/$_SESSION['user_id'] is set;
data: jdata
})
.done(function(data){
}) //ajax
}//
var name;
name= "<?php echo $_SESSION['user_id'];?>";
});
//$('#login').