我通过jQuery AJAX将一些数据发布到PHP脚本,一切都正确执行,但它返回404错误.在我的Firebug控制台中,PHP脚本的响应是正确的.我不明白脚本如何响应,它仍然抛出404错误.jQuery”error”回调方法触发,而”success”方法则不触发.
PHP脚本执行的所有语句都能正常工作,因为我可以看到数据库正在更新等.
我在Dreamhost托管的WordPress 3.x网站上使用jQuery 1.4.2.
– – – – – -更多信息 – – – – – –
好的,我已经发现当我wp-blog-header.php在Ajax脚本中包含WordPress的文件时,我得到了错误.此外,曾几何时这些脚本工作,我90%肯定他们在WP 3.0更新后停止工作.我将粘贴Firebug的Response头.
这个来自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