jQuery Ajax returning 404 Error, but correct Response

后端 未结 6 1537
既然无缘
既然无缘 2020-12-01 18:07

I\'m posting some data to a PHP script via jQuery AJAX, and everything executes correctly, but it returns a 404 error. In my Firebug console the response from the PHP scrip

6条回答
  •  独厮守ぢ
    2020-12-01 18:26

    I had the same problem.

    The Fix.

    Change:

    require_once('wp-blog-header.php');
    

    To:

    require_once('conn.php');
    require('wp-config.php');
    $wp->init();
    $wp->parse_request();
    $wp->query_posts();
    $wp->register_globals();
    

    This will also fix HTTP header errors if you want to have a page outside WP.

提交回复
热议问题