Hello fellow developers.
I'm trying to check if an ID exists in the database using JS prompt as a input method and PHP as the database checker. My issue is that I can't pass the inputted ID into PHP and then give a response to the JS if the ID exists or not.
JS Code:
function clockInPrompt() {
    var eID = prompt("Please enter your employee ID");
    if(eID != null) {
        var call_checker = <?php echo check_eID($conn) ?>;
        if(id_check_response) alert("true");
        else alert("false");        
    }           
}
PHP Code:
function check_eID(mysqli $conn) {
    $id = 123;
    $sql = mysqli_query($conn, "SELECT `eID` FROM `employees` WHERE `eID` = '$id'");
    if(mysqli_num_rows($sql) <= 0) echo '<script>var id_check_response = false;</script>';
    else echo '<script>var id_check_response = true;</script>';
}
With the code above I'm at least trying to get a response from the PHP.
 
    