Bonjour,
Dans le souci de rendre mon progiciel plus interactif, je souhaitais intégrer une boite de dialogue JQuery.
J'ai une table "observations_or" qui recense les observations faites par les utilisateurs. A l'ouverture de la page liée à l'article, si une observation a été faîte l'internaute prend connaissance de la dernière observation via une boite de dialogue. Il peut alors supprimer ou ne pas supprimer ce commentaire.

Code php : 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
37
38
39
40
41
42
43
44
45
46
47
48
49
	<?php
	// Vérifier si des observations ont déjà été enregistrées
	$resultObservations = $bdd->query("SELECT count(CODE) FROM `observations_or` WHERE ID_VEHICULE='".$id_chargee."'");
	$rowObservations = $resultObservations->fetch();
	$totalObservations = $rowObservations[0];
	$resultObservations->closeCursor();
 
	// Charegement de la variable observations
	if ($totalObservations){
		$chercherObservations = $bdd->query("SELECT*FROM `observations_or` WHERE ID_VEHICULE='".$id_chargee."'");
		$rowCommentaires = $chercherObservations->fetch();
		$idObservations=$rowCommentaires["ID"];
		$observations=$rowCommentaires["OBSERVATIONS"];
		$suiviObservations=$rowCommentaires["SUIVI"];
		$dateEditionObservations=date("d-m-Y",strtotime($rowCommentaires["DATE_EDITION"]));
		$chercherObservations->closeCursor();
		?>
		<div id="dialog" title="Information interventions relevées">
		<strong>Des observations onté été relevées le <?php echo $dateEditionObservations;?> par <?php echo $suiviObservations;?> :</strong><br/>
		<p style="font-size: small;font-style: italic;"><?php echo $observations;?></p>
		<p><strong>Souhaitez vous supprimer cette observation ?</strong></p>
		</div>
		<script src="http://code.jquery.com/jquery.min.js"></script>
		<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script> 
		<script>
		  $(function() {
			$( "#dialog" ).dialog({
			  modal: false,
			  height:400,
			  width:600,
			  zindex:1000,
			  buttons: {
				"Oui": function() {
 
				  $( this ).dialog( "close" );
					<?php
					    $req = $bdd->exec('DELETE FROM `observations_or` WHERE `ID` = '.$idObservations);
					?>
				},
				"Non": function() {
				  $( this ).dialog( "close" );
				}
			  }
			});
		  });
		</script>
		<?php
	}	
	?>

Le problème, c'est que je choisisse "Oui" ou "Non", la ligne est effacée. Je ne comprends pas vraiment.

Quelqu'un aurait-il une solution ?

D'avance merci.

Michel