javascript - ajax is not fetching session
one text
I have sending an ajax request but the session is not working there Here is my jquery code
$.ajax({
url: 'practice3.php',
type: 'GET',
data: {id: ids},
success: function (response) {
if (response == 1) {
//$('.cart-items').html(response);
alert('Add');
} else if (respone == 0) {
location.replace('loginregister.php');
}
},
});
Dont Get confused with id this is the data i was sending in ajax but first i wanted to check is session is working or not but didnt response anything and yes xhr status is 200 and here is my ajax code
<?php
ob_start();
session_start();
if (isset($_SESSION['email'])) {
echo 1;
} else {
echo 0;
}
?>
Please anyone help me out
Source