I have the following js :
$("a.bloqDesbloq").click(function() {
$.post ("../_requeridos/alteraAdministrador.php", {
idAdministrador : $(this).attr('idAdmin'),
bloq : $(this).attr('bloq')
}, function(_retorno){
retorno = JSON.parse(_retorno);
if (retorno[1] == "OK") {
url = $("a[idAdmin='" + retorno[3] + "']").find('img')
bloqueio = $("a[idAdmin='" + retorno[3] + "']")
if (retorno[2] == "s")
url.prop("src",'_img/desbloquear.png'),
bloqueio.prop('bloq','n')
if (retorno[2] == "n")
url.prop("src",'_img/bloquear.png'),
bloqueio.prop('bloq','s')
//location.reload();
} else {
alert("Erro no bloqueio");
}
}
);
return false;
});
This part of the code,
if (retorno[1] == "OK") {
url = $("a[idAdmin='" + retorno[3] + "']").find('img')
bloqueio = $("a[idAdmin='" + retorno[3] + "']")
if (retorno[2] == "s")
url.prop("src",'_img/desbloquear.png'),
bloqueio.prop('bloq','n')
if (retorno[2] == "n")
url.prop("src",'_img/bloquear.png'),
bloqueio.prop('bloq','s')
//location.reload();
}
It aims to change 2 things:
A) The image of the link
B) A attribute called block that gets 2 possible values 's'
or 'n'
;
The image is changing correctly. But the attribute block is not there.
Where am I going wrong?
Here's HTML
<a class='bloqDesbloq' idAdmin=<?php echo $administrador->getIdAdmin(); ?> bloq='s'>
<?php echo $imagem; ?>
</a>
What changes according to the reading in the bank