我通过 jQuery AJAX 将一些数据发布到 PHP 脚本,一切都正确执行,但它返回 404 错误。在我的 Firebug 控制台中,PHP 脚本的响应是正确的。我不明白脚本如何响应,它仍然抛出 404 错误。 jQuery“错误”回调方法会触发,而“成功”方法则不会。
PHP 脚本执行的所有语句都能准确运行,因为我可以看到数据库正在更新等。
我在 Dreamhost 托管的 WordPress 3.x 网站上使用 jQuery 1.4.2。
- - - - - -更多信息 - - - - - -
好的,我发现当我包含 WordPress 时wp-blog-header.php
文件中的 Ajax 脚本,我收到错误。另外,从前这些脚本可以工作,我 90% 确信它们在 WP 3.0 更新后停止工作。我将粘贴来自 Firebug 的响应标头。
来自 PHP 的标头响应包含 wp-blog-header.php 并在 Firebug 中返回 404 错误...
Date Tue, 10 Aug 2010 01:44:44 GMT
Server Apache
X-Powered-By PHP/5.2.6
X-Pingback http://www.learnwake.com/xmlrpc.php
Expires Wed, 11 Jan 1984 05:00:00 GMT
Cache-Control no-cache, must-revalidate, max-age=0
Pragma no-cache
Last-Modified Tue, 10 Aug 2010 01:44:44 GMT
Vary Accept-Encoding
Content-Encoding gzip
Content-Length 36
Keep-Alive timeout=2, max=98
Connection Keep-Alive
Content-Type text/html; charset=UTF-8
来自 PHP 的标头响应不包含 wp-blog-header.php 并在 Firebug 中返回 200 OK...
Date Tue, 10 Aug 2010 01:44:58 GMT
Server Apache
X-Powered-By PHP/5.2.6
Vary Accept-Encoding
Content-Encoding gzip
Content-Length 36
Keep-Alive timeout=2, max=100
Connection Keep-Alive
Content-Type text/html