Bonjour,
J'utilise jquery pour récuperer des informations via un fichier php. je souhaite recupérer ces informations sous forme xml pour pouvoir les réutiliser. Mais malheureusement, ça ne passe pas.
Voici mon code:

Fichier php:
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
 
<?		header('Content-Type: text/xml');
		$xml="<?xml version=\"1.0\"?>\n";
		include("../connexions/connexion.php");	
		$idprojet=$_POST['idprojet'];
		$sqlaff = 'SELECT * FROM tbl_bnetd, tbl_secteursactivites, tbl_localicasions
		WHERE tbl_bnetd.secteur_id=tbl_secteursactivites.secteur_id
		AND tbl_bnetd.localisation_id=tbl_localicasions.localisation_id
		AND tbl_bnetd.idprojet='.$_POST['idprojet'];
		$queryaff = mysql_query($sqlaff) or die('Erreur MySQL2 : '.mysql_error());
		$dataaff=mysql_fetch_assoc($queryaff);
		$xml.='<root>';
		$xml.='<projet>';
		$xml.='<idprojet>'.$dataaff['idprojet'].'</idprojet>';
		$xml.='<nomprojet>'.$dataaff['nomprojet'].'</nomprojet>';		 
		$xml.='<detailprojet>'.$dataaff['detailprojet'].'</detailprojet>';		  
		$xml.='<secteur_id>'.$dataaff['secteur_id'].'</secteur_id>';		  
		$xml.='<secteur_nom>'.$dataaff['secteur_nom'].'</secteur_nom>';		  
		$xml.='<localisation_id>'.$dataaff['localisation_id'].'</localisation_id>';		  
		$xml.='<localisation_nom>'.$dataaff['localisation_nom'].'</localisation_nom>';		  
		$xml.='</projet>';		
		$xml.='</root>';
		echo($xml);
?>
Code jscript avec jquery

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
 
function xmlParser(xml) {
		alert("Bonjour "+xml);
		$('projet',xml).each(function () {
			alert($(this).find('idprojet').text());
 
 
		})
		}
 
 
		$('#lkmodif').click(function(){
			actionfrm="actionfrm=affoper"+"&"
			idprojet="idprojet=1"+"&"
			bnetd = idprojet+actionfrm //liste de tes donnes a inserer
			$.ajax({
				type: "POST",
				async: false,
				//dataType:"xml",
				url: "../services/rechprojetbnetd.class.php",//chemin de ton fichier php
				data: bnetd,
				success: xmlParser,
				error:function(xml){ alert("error "+xml) }
				})
		})
J'obtiens: error [XMLHttpRequest]
ça fait 8 jour que je suis bloqué. Si quelqu'un pouvait me sortir de ce petrain, ce serait sympa. Merci d'avance