I want to get section_id from php session by ajax call
it return undefined
<?php $_SESSION['active_sectionid']= intval($_GET["section_id"]); ?>
<script>
function get_sectionid() {
$.ajaxSetup({cache: false});
$.get('/ajax/getsession.php', function (data) {
return data;
});
return ;
}
$(document).ready(function (e) {
var section_id;
$('.section_selected').on('click', function (e) {
section_id=get_sectionid();
alert(section_id);
});
});
</script>
getsession.php
<?php
if (session_status() == PHP_SESSION_NONE) session_start();
echo $_SESSION['active_sectionid'];
?>
or any idea to update section_id after jaxa call