i want check if variable inside php is have active value i test like this but not work
i have this var inside check.php
$status = 'active';
and i have this inside javascript file
$.ajax({
type: "POST",
url: "check.php",
success: function(check) {
var statusJS = '<?php echo $status; ?>';
if (check[statusJS] == "active" {
alert("status : active");
}}})
this full check.php file
<?php
$status = 'active';
$gpa = 'html data here';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
echo $gpa;
echo $status;
} else {
include("gp-e.php");
}
?>
it is possible to get variable value from php in javascript without echo it in php file ?