Bonjour, je n'arrive pas a récupérer ma réponse texte à l'aide de ma requête ajax que voici :
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
 
url = "files/tarif_reduction_achat_ajax.php";
taux=parseInt(a);
nb_credit = document.getElementById('nb_credit').value;
 
new Ajax.Request(url, {
	method: 'get',
	parameters: {nb_credit: nb_credit},
		onSuccess : function(reponse) {
		var response = reponse.responseText;
		alert(reponse);
		total=(taux)*(nb_credit);
		document.getElementById("total").replace("<p id='total' class='nombre'>" +total+ " &euro;</p>"); 
		document.getElementById("prix_total").value=total;	
	},
	});
et voici la page php correspondante :
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
	$a=0;
 
	while($element=mysql_fetch_array($res_palier)){
	$palier[$a]=$element['palier_credit'];
	$reduc[$a]=$element['reduction'];
	$a++;
	}
 
	if(($nb_credit >= 0) && ($nb_credit < $palier[0])){
		echo ("Aucun reduction");
	}
 
for($i=0; $i<($a-1); $i++){
	if(($nb_credit >= $palier[$i]) && ($nb_credit < $palier[$i+1])){
		//echo("-".$reduc[$i]."%");
		echo ("ok");
	}
Merci