jquery ajax error 404,jQuery Ajax returning 404 Error, but correct Response

博主在尝试使用jQuery AJAX向PHP脚本发送数据时遇到了404错误,即使PHP脚本的响应正确且数据库更新成功。问题出在当PHP脚本包含WordPress的wp-blog-header.php文件时,错误发生。经过调查,发现这个错误可能是在WordPress升级到3.0之后开始的。 Firebug显示,不包含wp-blog-header.php的脚本返回200状态码,而包含它的脚本则返回404。这表明问题可能与WordPress的集成或配置有关。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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 script is correct. I don't understand how the script can respond, and it is still throwing a 404 error. The jQuery "error" callback method triggers, and the "success" method doesn't.

All statements performed by the PHP script work accurately, because I can see the database being updated, etc.

I'm using jQuery 1.4.2, on a WordPress 3.x website hosted by Dreamhost.

-----------MORE INFO-----------

OK, I've figured out that when I include WordPress's wp-blog-header.php file in the Ajax script, I get the error. Also, once upon a time these scripts work, and I am 90% sure they stopped working after the WP 3.0 update. I'll paste in the Response headers from Firebug.

This header response from PHP that includes the wp-blog-header.php and returns a 404 error in 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

This header response from PHP that doesn't include the wp-blog-header.php and returns a 200 OK in Firebug...

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值