I try to achieve a simple coding, but for some reason I can't understand, attributes doesn't work anymore in ajax success function.
$('#modaleCalendarEvent #tbPrenomPatient, #modaleCalendarEvent
#tbNomPatient').change(function(){
CheckNomEtPrenom();
});
....
function CheckNomEtPrenom(){
var prenom = $('#modaleCalendarEvent #tbPrenomPatient').val();
var nom = $('#modaleCalendarEvent #tbNomPatient').val();
......
$.ajax({
type: "POST",
url: "actions/blahblah.php",
data: params,
dataType: "json",
dataFilter: function(data, type){
return data;
},
error: function(xhj, statut, thrown){
alert('Erreur: '+xhj.responseText);
},
success: function(resultat){
if(resultat.Valeur == -1 || resultat.Valeur == 1)
{
$('#modaleCalendarEvent #cbxModalePatients').val(resultat.PatientID);
$('#modaleCalendarEvent #tbManuel').removeAttr('checked'); // HERE
$('#modaleCalendarEvent #tbManuel').trigger('change');
Notify("info", prenom + " " + nom + " already exists. Selection updated");
}
else // -2 existe pas en base
{
VerifieMetier();
}
HideLoaderPage();
}
});
}
Before I call ajax, I can (even by console) add or remove the attribute 'checked' on #tbManuel successfully. But when I'm in my success ajax section, remove or add attribute doesn't work. Graphically it doesn't check or uncheck the checkbox. and no event raised.
I can trigger it manually, but still the checked atttribute is not set or deleted and I can't test it.
A timer with instruction laucnhed after some seconds doesn't work neither. And I go in my if inside success instructions, my "resultat.Valeur" is correctly set. In debug in chrome I can see step by step.
Does someone has an explaination? and maybe a solution ? It's a simple case but really weird. Like the ajax success instructions are in another context or something like that.
Thanks a lot