views:

470

answers:

6

On my development machine everything works fine. On the live server (Godaddy), the AJAX requests from BuddyPress are returning results and a 404 error in FireBug. But the script is seeing the results as a fail and the indicators continue to spin.

Example: http://jobaru.com/ on the homepage there is Newest | Active | Popular under memebers using the AJAX as well as the letters on the groups page.

Things I have tried: Double checked the file was actually there first, checked permissions to be able to read. Did a fresh install.

Any ideas on why it would return 404 header and valid response?

A: 

I'm taking a look at the AJAX response, and it looks like instead of pure HTML that it's returning, it has this at the beginning: 0[[SPLIT]] and a zero at the end. Could this have something to do with it?

James Skidmore
0[[SPLIT]] is actually a positive response in BuddyPress and -1[[SPLIT]] is a negative response.
joelpittet
Can you post the AJAX code?
James Skidmore
A: 

make sure you already added the error handler for the ajax fail (error)? try to hide the spin indicator first to see the effect taking place.

動靜能量
It seems to handle the AJAX fail, the weird thing is the response is coming through fine but it is sending along 404 header which is confusing the ajax script. 2 others have reported this on Godaddy with no successful results. I have a support request in to them but thinking you guys may be more helpful.
joelpittet
+1  A: 

This seems like it's something with GoDaddy, judging by your comments. Until you hear back from their support, I'd modify the AJAX script to ignore the 404 error for that particular request.

James Skidmore
+2  A: 

I don't know why it returns 404, but try adding this line of code to /wp-content/plugins/buddypress/bp-core/bp-core-ajax-handler.php before do_action()

status_header( 200 );

I'm running a heavily modified version of BuddyPress 1.0 RC1, and intercept the ajax posts in bp-custom.php, but setting the status header in the custom file before I did my own logic worked just fine for me.

postpostmodern
That totally did it! Wow, thank you.
joelpittet
A: 

FWIW, I have seen the exact same problem with JSON-formatted replies as part of a WordPress plugin when hosted at GoDaddy.com. The JSON results are sent correctly, but the HTTP response has a status code of 404.

I am fairly convinced that this is a problem with their Apache header/configurations, and I will be trying to get a hold of their tech support team (wish me luck) in an attempt to get to the bottom of this.

I will post here if I get a response back from them.

Jason Buberel
Problem was also resolved by adding the status_header( 200 ) function call when making an AJAX request:if($_GET['ajax']){ status_header( 200 ); ...}
Jason Buberel
A: 

I was getting the 404 response error while playing with Country city dropdown menu using AJAX and the problem was

Then I gave a complete url as listed hereunder;-

Qasim Ali Khawaja