tags:

views:

170

answers:

5

My html page sends an ajax request (POST) to PHP, PHP echo a json object.

Code has been tested and worked fine at my development view.

However, after they are uploaded to a VPS hosting server, the returned json string is empty (I used alert() at the response function to display the responseText and found out it was empty).

Could someone have seen this problem before?

A: 

We can't solve a problem without the actual code. What does the code rely on? Are there paths which are different on the two servers? Environment variables? Database connectivity? Etc etc.

Devin Ceartas
A: 

No. I check the database and the request has been performed. I am guessing it is a configuration problem with PHP. Like security setting.

I will write a testing page and php and post later.

Kevin
Don't write comments as an answer to your question unless you found a solution. Use the comment sections.
Ambrosia
A: 

Just check the php configuration on both machines. Like on my machine $text will work on my provider I have to write like $_GET['text'] due to security settings. The PHP configuration will give you an idea of what's wrong, or what packages need to be installed.

Priyank Bolia
A: 
Kevin
A: 

I am new here. I have not figured out how to add a comment. (Please let me know.)

I changed the php code to return a string, it worked. so the problem is after json encoding.

new test.php (worked).

if(!isset($_POST['A'])||!isset($_POST['B'])) { echo "Failed"; } else { echo "OK"; }

Kevin