0
I’ve got the code below that’s really pissing me off.
It’s not possible people!
// JavaScript Document// JavaScript Document
$(document).ready(function(e) {
$("a.excluiFalecimento").click(function() {
if (confirm('Deseja Excluir esta Nota?') ) {
$.post ("../_requeridos/excluiFalecimento.php", {
idFalecimento : $(this).attr('falecimentoid')
}, function(retorno){
alert(retorno)
if (retorno == "OK") {
alert('Excluido com sucesso');
location.reload();
} else {
alert("Erro na exclusão");
}
}
);
return false;
}
})
});
I have 4 files exactly the same except for the variable names only.
I got a alert
who is printing OK
alert(retorno)
if (retorno == "OK") {
But it doesn’t enter the correct block.
And it obviously doesn’t do the Reload.
Where am I going wrong?
Detail, deletion is being done normally.
yes, indeed that was it. But why did the other 3 identical files not give this problem? Note: I have already looked at his GOOD signature. There is not. It’s like UTF without GOOD
– Carlos Rocha
rs.. I cannot say, each case is to be analyzed.
– Sam
Due to the doubts, in these cases where a string is expected and you want to make an extended comparison on
if
, it is good to use.trim()
. Or else you could useif(~retorno.indexOf("OK")){...}
– Sam