I have a Javascript function which calls a PHP script on my server. In case of failures, the JS function is expecting to receive a message of save_failed
from the script.
For testing purposes, I put the wrong database info in the line below so that it fails:
mysql_connect("hostname", "user", "pass") or die('save_failed');
However, the JS function was not behaving as expected, and it seemed it wasn't receiving save_failed
as the output. To confirm, I displayed the message being received as an alert box and this is what I got.
Why is the php script not throwing just save_failed
and how can I make it do that?