0

I have an application that posts data to a php script through jquery's ajax post function. This script validates the data and returns predefined error messages if the data is incorrect which the application parses into a readable form for the client.

The issue is that ajax posts the data just fine to the script, because invalid data is successfully converted into error messages and sent back to the application for parsing. However, when I enter the correct data the script sends back a 500 response error.

The most puzzling part is that on PHP 5.3.8 (my test server) the application works just fine. However, on my clients server (PHP 5.0) the aforementioned error manifests. I am completely lost here. I have tried trapping the post errors with .error but I am not really sure how exactly I am supposed to extract anything meaningful out of this response code.

3
  • Your code... It's not here... Commented Mar 24, 2012 at 21:48
  • 1
    Use your browsers console to check the Ajax call, and check the responsetext. If possible also enable PHP error reporting on the webserver to see if the internal error is in PHP, and chances are it probably is? It's impossible for us to know why you have an internal server error without seeing much of anything? Commented Mar 24, 2012 at 21:49
  • I know, I am sorry but the code really won't make much sense if I post it here. It isn't json by the way. I checked the browsers response text with firebug and it is empty. To be precise it says '' Commented Mar 24, 2012 at 22:11

1 Answer 1

1

Your jQuery code have no problem. You should log the PHP error, and see what's wrong. Alternatively, if you display errors (what you shouldn't do on a production server), you can have a look directly on Firebug by displaying the request's response.

Sign up to request clarification or add additional context in comments.

6 Comments

If you don't have anything in Firebug, then it's time to check your error log, and if nothing yet, your error reporting settings
By the way, it doesn't make sense that incorrect code would work just fine on php 5.3 where as it would die on 5.0 Unless I am using some function calls that are exclusively a part of 5.3 and above I don't see how this is possible.
Many server settings can be different. You have an error, try to find its log. After that it won't be a big deal to debug it.
error_reporting(E_ALL); ini_set('display_errors','On'); Will that work? This is rather annoying because my client hasn't provided me ftp rights to upload and test the application on his server. I have to wait for him to upload and update the files I send in. God...
ini_set("display_errors", "on") won't work, it has to be done directly in php.ini :( And good luck to debug it if you can't see the logs nor changing this setting!!
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.