我通过jQuery AJAX发布一些数据到PHP脚本,一切执行正确,但它返回一个404错误。在我的Firebug控制台中,PHP脚本的响应是正确的。我不明白脚本如何响应,它仍然引发404错误。 jQuery“错误”回调方法触发器,而“成功”方法不会。
由PHP脚本执行的所有语句都准确地工作,因为我可以看到正在更新的数据库等。
我使用jQuery 1.4.2,在由Dreamhost托管的WordPress 3.x网站。
– – – – – -更多信息 – – – – – –
OK,我已经知道,当我包括WordPress的wp-blog-header.php文件在Ajax脚本,我得到的错误。此外,一次一次这些脚本工作,我90%肯定他们在WP 3.0更新后停止工作。我将粘贴在Firebug的响应头中。
这个标题响应从PHP,包括wp-blog-header.php并返回一个404错误在Firebug …
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