0

im having this problem. I'm making a HTML file that has an Ajax Call on it, but when i make the call the error i get is a 404 Not Found Error. But when i go to the path that is inside the call i get the result of the PHP file without any problem.

The PHP file contains a Wordpress file Include.

The Ajax call is this:

$(function () {
    $("#autorizacion").submit(function () {
        datos = $(this).serialize()
        $.ajax({
            type: "GET",
            url: "http://somesite.com/authorization.php",
            dataType: "HTML",
            data: datos,
            beforeSend: function () {
                alert(datos);
            },
            error: function (xhr, status, error) {
                alert(error);
            },
            success: function (res) {
                alert(res);
            }
        })
        return false;
    })
})

And the PHP file contains this:

header("HTTP/1.1 200 OK");
$user = $_GET['User'];
$pass = $_GET['pass'];
global $wp, $wp_rewrite, $wp_the_query, $wp_query;
if (empty($user) || empty($pass)) {
    echo 'Los Campos no pueden estar vacíos';
} else {
    require_once('wp-blog-header.php');
    $status = 'false';
    $auth   = wp_authenticate($user, $pass);
    if (is_wp_error($auth)) {
        $status = 'false';
    } else {
        $status = 'true';
    }
}
echo $status;

Thanks for the answers and advices.

Christian Gollhardt
  • 16,510
  • 17
  • 74
  • 111
Sebastian Hernandez
  • 2,257
  • 4
  • 23
  • 32

0 Answers0