Salut à tous,

Question sur l'appel de la fonction this._setPraticien(val[0], val[1]) dans le onSuccess.
Comment faire pour que cela fonctionne?

Erreur JS: this._setPraticien is not a function

Merci

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
function Agenda(nom){
	console.log('Creation instance Agenda');
 
	///////////////
	//Methode set//
	///////////////
	this._setListePraticien = function(){
		$.ajax({
			async: false,
			type: "GET",
			url: "scriptsPHP/agenda.php?type=praticien",
			error:function(msg){alert( "Erreur !: " + msg );},
			success:function(data){
				sel = document.createElement("select");
				sel.setAttribute('id', 'praticien');
				sel.setAttribute('style', 'width: 190px;');
				pra = data.split("//");
				for(i=0;i<pra.length-1;i++){
					val = pra[i].split("--");
					opt = document.createElement("option");
					opt.setAttribute('value',val[0]);
 					opt.appendChild(document.createTextNode(val[1]));
					sel.appendChild(opt);
					(i==0) ? this._setPraticien(val[0], val[1]) : '';
				}
				divprat = document.getElementById('prat');
				this.addEvent(sel,'change',function(){this.rechargerAgenda();});
				divprat.appendChild(sel);
			}
		});
	}
 
	this._setPraticien = function(id, nom){
		this.idPraticien = id;
		this.nomPraticien = nom;
	}