in

Error when using php ajax to check input data with the system


I am learning how to use php ajax to check if registered email data already exists in the system. But when used, the result returned from success:function(data) is always the source code of the original php page (as shown in the image below).
Here is my javascript code

    $(document).ready(function(){
    $("#email").change(function(){
        $.ajax({
            URL: "process-email.php",
            type: "post",
            data: {email:$(this).val()},
            success:function(res) {
                console.log(res);
            }
        })
    })
})

This is the destination for data processing

<?php
    include "config/config.php";
    $result = mysqli_query($conn,"SELECT * FROM tb_user WHERE email="" . $_POST["email'] . "'");
    if(mysqli_num_rows($result) <= 0)
    {
        echo "OK.";
    }else{
        echo "Already exist.";
    }
?>

And here is the data sent to my main site

Is there any way to fix it? Thanks everyone!



Source: https://stackoverflow.com/questions/70540043/error-when-using-php-ajax-to-check-input-data-with-the-system

Huawei Revenues Down by Almost 30% in 2021

A kubernetes plugin which enables dynamically add or remove GPU resources for a running Pod