I have a simple ajax request. It calls a PHP page and makes a connection to a MySQL database.
Even if the connection fails (because I turn off the MySQL service), the success part of my ajax call gets triggered...
$.ajax(
{
type: "POST",
url: "ajax.php",
timeout: 10000,
data: (
{
"type": "approveAndEmail",
"id": id
}),
error: function(){
alert('error');
},
success: function(response)
{
alert('yes');
}
});
Any ideas?
My PHP looks like this (and yes I will be updating from mysql_connect!
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");