Bonjour,

Je souhaite rafraîchir deux div à partir d'une fonction ajax. dans ces deux div, je souhaite insérer du code html différent dans chaque div.
Pour l'instant, j'arrive à en rafraîchir un mais, pour le second, rien ne se passe. Pourtant, je reçois bien ma fonction lorsque je contrôle dans l'outil de développement de firefox (dans "inspecter la requête réseau", je vois le contenu de ma réponse).

L'élément déclencheur est un radio (sur deux) bouton qui est cliqué. le choix est envoyé instantanément à une fonction ajax avec un attribut (le choix du radio cliqué) -> getIdentite(this.value).

Code html : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
personne morale
<input type="radio" name="identite" value="0" id="persmorale" onclick="getIdentite(this.value)">
particulier
<input type="radio" name="identite" value="1" id="persphysique" onclick="getIdentite(this.value)">

Dans la fonction ajax getIdentite(int), je créé deux requêtes auxquelles j'attache un élément, une focntion php et j'envoie mes deux requêtes séparément. Dans firefox, je reçois bien mes deux fonctions php appelées par le javascript.

Ci-dessous, codes php :
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
<?php 
	session_start();
?>
<!DOCTYPE html>
<html lang="fr">
    <head>
        <title>urbanisme - création dossier</title>
 
 
 
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <link rel="stylesheet" type="text/css" href="styles/styleurba.css" />
    </head>
    <body>
		<?php include("urbanisme/fencreer.php");?>
    </body>
</html>

Code fencreer.php :
Code html : 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
<div method="post" action="envoiforms/services.php" id="fen1">
<script type="text/javascript" src="ajax/ajax1.js"></script>
 
	<div id="divhaut">
		<div class="backcolor" id="hgauche">
			<h1 class="titles">Identité du demandeur</h1>
			<div id="choixidentite">
				personne morale
				<input type="radio" name="identite" value="0" id="persmorale" onclick="getIdentite(this.value)">
				particulier
				<input type="radio" name="identite" value="1" id="persphysique" onclick="getIdentite(this.value)">
			</div>
			<div id="divpersh">	
				<!--  affichage par affichidentite.php et ajax/ajax1.js à partir du <div id="choixidentite">-->
			</div>
			<div id="listepers">
 
			</div>
			<div class="boutons">
				<button type="button" value="valider" id="valider" onmouseup="validerModif();">VALIDER</button>
				<button type="button" value="effacer" id="effacer" onmouseup="effacerModif(false);">EFFACER</button>
				<button type="button" value="ajouter" id="ajouter" onmouseup="annulerModif();">ANNULER</button>
				<br/><br/>
			</div>
		</div>
		<div class="backcolor" id="hdroite">
		hdroite
		</div>
	</div>
	<div id="divbas">
		<div class="backcolor" id="bgauche">
		bgauche
		</div>
		<div class="backcolor" id="bmilieu">
		bmilieu
		</div>
		<div class="backcolor" id="bdroite">
		bdroite
		</div>
	</div>
	</div>
</div>


ajax1.js
:
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
function getIdentite(int)
{
	  if (window.XMLHttpRequest) {
		    // code for IE7+, Firefox, Chrome, Opera, Safari
		    xmlhttp=new XMLHttpRequest();
		    xmlhttp2=new XMLHttpRequest();
		  } else {  // code for IE6, IE5
		    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		    xmlhttp2=new ActiveXObject("Microsoft.XMLHTTP");
		  }
  xmlhttp.onreadystatechange=function()
 	{
	    if (xmlhttp.readyState==4 && xmlhttp.status==200) {
	      document.getElementById("divpersh").innerHTML = xmlhttp.responseText;
	    }
	}
	  xmlhttp.open("GET","affichidentite.php?identite=" + int,true);
	  xmlhttp.send();
 
  xmlhttp2.onreadystatechange=function()
 	{
	    if (xmlhttp2.readyState==4 && xmlhttp2.status==200) {
	      document.getElementById("divlistepers").innerHTML = xmlhttp2.responseText;
	    }
	}
  	xmlhttp2.open("GET","affichlistepers.php?identite=" + int,true);
  	xmlhttp2.send();
}
affichidentite.php :
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
50
51
52
53
54
55
56
57
58
<?php
$ident = $_REQUEST['identite'];
 
//personne morale
if ($ident == 0) {
  echo '		<label for="denomination">Dénomination : </label>
				<input type="text" id="denomination" name="denomination" />				
  		
  				<label for="siret">SIRET : </label>
				<input type="text" id="siret" name="siret" />
				
				<label for="raisonsociale">raison sociale : </label>
				<input type="text" id="raisonsociale" name="raisonsociale" />
  				<br/>
  				<p>Représentant de la personne morale :</p>
  				<br/>
  		
  				<label for="madame">Madame</label>		
  				<input type="radio" name="genre[]" value="0" id="madame"/>
  		
  				<label for="monsieur">Monsieur</label>		
  				<input type="radio" name="genre[]" value="1" id="monsieur"/>

  				<label for="nom">Nom : </label>
				<input type="text" id="nom" name="nom" />
				
				<label for="prenom">prenoms : </label>
				<input type="text" id="prenoms" name="prenoms" />
  		';
}
//particulier
if ($ident == 1) {
  echo '		<label for="madame">Madame</label>		
  				<input type="radio" name="genre[]" value="0" id="madame"/>
  		
  				<label for="monsieur">Monsieur</label>		
  				<input type="radio" name="genre[]" value="1" id="monsieur"/>
  				<br/><br/>
  				<label for="nom">Nom : </label>
				<input type="text" id="nom" name="nom" />
				
				<label for="prenom">prenoms : </label>
				<input type="text" id="prenoms" name="prenoms" />
  				<br/><br/>
  		
  				<label for="datenaiss">Date de naissance (aaaa-jj-mm) :</label>
  				<input type="date" value="2014-25-12" id="datenaiss"/>
  		
  				<label for="lieunaiss">Commune de naissance :</label>
  				<input type="text" id="lieunaiss"/>
  		
  				<label for="dept">Département :</label>
  				<input type="text" id="dept"/>
  				<br/><br/>
  		';
}
 
?>

affichlistPers.php :
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
<?php
$ident = $_REQUEST['identite'];
 
if ($ident == 0) {
  echo '		<table id="tabpers">
					<tr>
						<th>Dénomination</th>
						<th>Raison sociale</th>
						<th>SIRET</th>
						<th>Nom</th>
						<th>Prénom</th>
					</tr>
				</table>
  		';
}
//particulier
if ($ident == 1) {
  echo '		<table id="tabpers">
					<tr>
						<th>Nom</th>
						<th>Prénoms</th>
						<th>Date naiss</th>
						<th>Commune naiss</th>
						<th>Dépt naiss</th>
					</tr>
				</table>
  		';
}
?>

Et le styleurba.css :
Code css : 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
@CHARSET "utf-8";
html,body{
	/* Supprimer les éventuelles marges extérieures */
	margin:0px;
	/* Supprimer les éventuelles marges intérieures */
	padding: 0px;
	/* Couleur de fond = blanc */
	background-color: #9BF6FB;
	/* Utilisation de la totalité de la largeur de la page */
	width:100%;
	/* Police utilisée */
	font-family: Arial, Helvetica, sans-serif;
	/* Taille de la police utilisée */
	font-size:13px;
}
.colorlink
{
	color:#49F154;
}
.tb {
  display:table;
  width:95%;
}
 
#entete
{
	margin-top:20px;
	margin-left:auto;
	margin-right:auto;
	color: #5882EA;
	background-color: #D2FCFE;
	height:100px;
}
#blason
{
	display:table-cell;
	width:80px;
}
#titre
{
	display:table-cell;
	text-align:center;
	vertical-align: middle;
}
#date
{
	display:table-cell;
	width:150px;
	height:100%;
	vertical-align: top;
	font-size:16px;
}
 
 
/*
	MENU
*/
 
.menu {
  display:table;
  width:95%;
}
#divmenu
{	
	margin-top:20px;
	margin-left:auto;
	margin-right:auto;
}
ul
{
	display:table-row;
	color:#5882EA;	
}
li{
	background-color: #D2FFD5;
	vertical-align:middle;
	height:50px;
	display : table-cell;
	width: 150px;
	border-bottom: solid 1px;
}
li:hover{
	background-color: #D6E2FE;
	border-bottom: solid 1px;
}
.liclass
{	
	text-align: center;
	border-color: #7D9FF6;
	font-size: 20px;
}
.liclass a
{
	color:#5882EA;	
}
 
a
{	
	text-decoration: none;
}
 
/*
	Paramétrage de la BDD
*/
 
#fen1
{
	margin-left:auto;
	margin-right:auto;
	margin-bottom:auto;
	margin-top:20px;
	height:800px;
	display:table;
  	width:95%;
}
 
	#divhaut
	{
		display:table;
		margin:auto;
		width:100%;
		height:85%;
	}
		#hgauche
		{
			display:table-cell;
			margin:auto;
			width:50%;
			border-top: solid #A5BEFC 3px;
			border-left: solid #A5BEFC 3px;
			border-top-left-radius: 50px;
			vertical-align: top;
			height:80%;
		}
			#choixidentite
			{
				display:table;
				height:3%;
				text-align: left;
				padding-left: 40px;
			}
			#divpersh
			{
				display:table;
				height:20%;
				width:100%;
				margin-top: 20px;
			}
 
				#nom, #prenoms
				{
					width:200px;
				}
 
			#listepers
			{
				display:table;
				height:60%;
			}
 
				/* tableau de la liste des personnes*/
				table
				{
					border-collapse: collapse;
				}
				th
				{
					border: 1px solid black;
				}
 
		#hdroite
		{
			display:table-cell;
			width:50%;
			border-top: solid #A5BEFC 3px;
			border-right: solid #A5BEFC 3px;
			border-top-right-radius: 50px;
			height:80%;
			vertical-align: middle;
			background-color: green;
		}
	#divbas
	{
		display:table;
		margin:auto;
		width:100%;
		height:15%;
	}
		#bgauche
		{
			display:table-cell;
			margin:auto;
			width:60%;
			border-left: solid #A5BEFC 3px;
			border-bottom: solid #A5BEFC 3px;
			border-bottom-left-radius: 50px;
			vertical-align: middle;
			height:20%;
			background-color: blue;
		}
		#bmilieu
		{
			display:table-cell;
			width:20%;
			border-bottom: solid #A5BEFC 3px;
			height:20%;
			vertical-align: middle;
			background-color: yellow;
		}
		#bdroite
		{
			display:table-cell;
			width:20%;
			border-bottom: solid #A5BEFC 3px;
			border-right: solid #A5BEFC 3px;
			border-bottom-right-radius: 50px;
			height:20%;
			vertical-align: middle;
			background-color: pink;
		}
 
.boutons
{
	height:40%;
	display:table;
	vertical-align:middle;
	width:100%;
	height:50px;
}
 
.backcolor
{
	background-color: #D6E2FE;
	text-align: center;
}
 
.titles
{
	color:#5882EA;
}
 
/* ROUNDED ONE */
.roundedOne {
	width: 28px;
	height: 28px;
	background: #fcfff4;
 
	background: -webkit-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);
	background: -moz-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);
	background: -o-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);
	background: -ms-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);
	background: linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);
	filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fcfff4', endColorstr='#b3bead',GradientType=0 );
	margin: 20px auto;
 
	-webkit-border-radius: 50px;
	-moz-border-radius: 50px;
	border-radius: 50px;
 
	-webkit-box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0,0,0,0.5);
	-moz-box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0,0,0,0.5);
	box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0,0,0,0.5);
	position: relative;
}
 
.roundedOne label {
	cursor: pointer;
	position: absolute;
	width: 20px;
	height: 20px;
 
	-webkit-border-radius: 50px;
	-moz-border-radius: 50px;
	border-radius: 50px;
	left: 4px;
	top: 4px;
 
	-webkit-box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,1);
	-moz-box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,1);
	box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,1);
 
	background: -webkit-linear-gradient(top, #222 0%, #45484d 100%);
	background: -moz-linear-gradient(top, #222 0%, #45484d 100%);
	background: -o-linear-gradient(top, #222 0%, #45484d 100%);
	background: -ms-linear-gradient(top, #222 0%, #45484d 100%);
	background: linear-gradient(top, #222 0%, #45484d 100%);
	filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#222', endColorstr='#45484d',GradientType=0 );
}
 
.roundedOne label:after {
	-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
	filter: alpha(opacity=0);
	opacity: 0;
	content: '';
	position: absolute;
	width: 16px;
	height: 16px;
	background: #00bf00;
 
	background: -webkit-linear-gradient(top, #00bf00 0%, #009400 100%);
	background: -moz-linear-gradient(top, #00bf00 0%, #009400 100%);
	background: -o-linear-gradient(top, #00bf00 0%, #009400 100%);
	background: -ms-linear-gradient(top, #00bf00 0%, #009400 100%);
	background: linear-gradient(top, #00bf00 0%, #009400 100%);
 
	-webkit-border-radius: 50px;
	-moz-border-radius: 50px;
	border-radius: 50px;
	top: 2px;
	left: 2px;
 
	-webkit-box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0,0,0,0.5);
	-moz-box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0,0,0,0.5);
	box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0,0,0,0.5);
}
 
.roundedOne label:hover::after {
	-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=30)";
	filter: alpha(opacity=30);
	opacity: 0.3;
}
 
.roundedOne input[type=checkbox]:checked + label:after {
	-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
	filter: alpha(opacity=100);
	opacity: 1;
}

Merci de bien vouloir m'aider !