2
I got 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;
});
That 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) A image of link
B) A attribute called Bloq which receives 2 possible values 's'
or 'n'
;
To image is changing correctly. But the attribute Bloq is not.
Where am I going wrong?
Here is the HTML
<a class='bloqDesbloq' idAdmin=<?php echo $administrador->getIdAdmin(); ?> bloq='s'>
<?php echo $imagem; ?>
</a>
That changes as you read in the bank
Exactly that. It worked out! attr for HTML prop is only in DOM
– Carlos Rocha