0
Hello, I have two instructions on jQuery that I use for:
- Mark a checkbox
- Disable a radio Buttons.
The point is that these instructions run by the system does not work, but if I take the same and play on the browser console everything happens correctly
jQuery
$.ajax({
url: addressWebService+'auditoriaexcecao/getAuditorias/audi_id/'+audi_id,
type: 'get',
dataType: 'json'
}).done(function(r){
if(r.length >= 1){
var hora;
$.each(r, function(i, obj){
hora = obj.auex_hora.split(":");
hora[0] = hora[0] != '10' ? hora[0].replace("0", "") : hora[0];
var processo = obj.auex_proc_id == 1 ? "smt" : "";
/*Eu dei o console.log para ver oq estava sendo executado, se eu pegar o que printou no console, e executar por lá mesmo, funciona*/
console.log("$(\".div-pai[data-proc-id='"+obj.auex_proc_id+"']\").find(\"#tab"+hora[0]+processo+"\").find(\".check-ignorar-horario\").attr('checked', true);");
console.log("$(\".div-pai[data-proc-id='"+obj.auex_proc_id+"']\").find(\"#tab"+hora[0]+processo+"\").find(\".chck\").attr('disabled', 'disabled');");
/*Estas são as duas instruções que não funcionam*/
$(".div-pai[data-proc-id='"+obj.auex_proc_id+"']").find("#tab"+hora[0]+processo).find(".check-ignorar-horario").attr('checked', true);
$(".div-pai[data-proc-id='"+obj.auex_proc_id+"']").find("#tab"+hora[0]+processo).find(".chck").attr('disabled', 'disabled');
});
}
});
Can anyone see any mistake I’m not seeing?
Maybe the elements don’t exist at the moment they try to be used?
– BrTkCa
the worst they exist yes, that my ajax is a function q I only run when everything is already loaded
– Tafarel Brayan
@Lucascosta, maybe that’s right, because I gave a setTimeout of 800mls and it worked... But there arises another doubt, this ajax is within a function, which is only executed in . done from another ajax... he would not have to wait to complete the first to accomplish the second?
– Tafarel Brayan