发送邮件时出现错误404

I spent a lot of time on this bug, can someone notice what the reason is?

The Mail.php file is located in the project root.

//E-mail Ajax Send
$("form").submit(function() { //Change
    var th = $(this);
    $.ajax({
        type: "POST",
        url: "/mail.php", //Change
        data: th.serialize()
    }).done(function() {
        alert("Thank you!");
        setTimeout(function() {
            // Done Functions
            th.trigger("reset");
        }, 1000);
    });
    return false;
});

But it returns a 404:

ScreenShot

You can use either the absolute or relative path as stated above in comments. For your particular case, if both the files in same directory as you stated, just use "mail.php" no "/mail.php".

url: "mail.php", // in place of "/mail.php"

Alternatively you can use the url path like the below:

url: "www.example.com/mail.php", 

Hope this fix your 404 error