I have an ajax script which goes and queries a mysql DB in a php, if there is a record I return an echo "success"; and if not "without success";
$total = mysql_num_rows(mysql_query("SELECT * FROM dispositivos WHERE serie ='$serial'"));
if($total==0){
echo "sin exito";
}else
{
$sql=mysql_query("DELETE FROM dispositivos WHERE serie ='$serial'");
echo "exito";
}
this success or without success I keep it in
var respuesta = ajax.responseText
if I make an alert (answer);
Effectively shows me success or no success depending on the result of PHP, so I know that until here everything is fine
What I need is to do more things if it is a success, for which I did a
if(respuesta=="exito")
{
// cosas que voy a hacer
}
here's the problem, it does not enter the if, despite being "success" it passes it by, I tried with = and with ==
I do not know if I can not compare a variable with a string but it is assumed that the variable has a string so it could.