comment puis je appeler deux fonction javascript pour exécuter un code Ajax avec la javascript ??
voila mon code
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
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
<!DOCTYPE html>
<html>
<head>
<meta/ charset="utf-8">
<link rel="stylesheet" type="text/css" href="stfb.css">
	<title>Facebook</title>
	<script laguage="javascript">
function recuper() { //cmt=document.getElementById('cmt').value;
  xhr = new XMLHttpRequest();
  xhr.onreadystatechange = function () {
    if (xhr.readyState == 4)
    //alert(xhr.responseText);
    {
      if (xhr.responseText == 0) {
        document.getElementById('tab').value;
      } else {
        document.getElementById('affichage').innerHTML = xhr.responseText;
      }
    }
  }
  xhr.open('GET', 'affiche.php', true);
  xhr.send();
}
function ajout() {
  cmt = document.getElementById('cmt').value;
  xhr = new XMLHttpRequest();
  xhr.onreadystatechange = function () {
    if (xhr.readyState == 4)
    //alert(xhr.responseText);
    {
      if (xhr.responseText == 0) {
        document.getElementById('tab').value;
      } else {
        recuper();
      }
    }
  }
  xhr.open('GET', 'hallo.php?cmt=' + cmt, true);
  xhr.send();
}
function ajout_statut() {
  //cmt=document.intelligiblement('cmt').value;
  xhr = new XMLHttpRequest();
  xhr.onreadystatechange = function () {
    if (xhr.readyState == 4)
    //alert(xhr.responseText);
    {
      if (xhr.responseText == 0) {} else {
        document.getElementById('statut').innerHTML = xhr.responseText;
      }
    }
  }
  xhr.open('GET', 'ajoutstatut.php', true);
  xhr.send();
}
</script>
</head>
<body  onload="recuper();ajout_statut();">
<div id="access" role="navigation">
<div class="menu">
<ul>
<li class="page_item"><a title="FB Purity Homepage" href="">Home</a></li>
</ul>
</div>
</div>
 
 
<div align="left">
<div id="statut"> </div><br>
 
<div id="affichage"></div>	<br>
<table width="50%" border="0" >
<tr>
<td width="100%"><input type="text" id="cmt" name="cmt"></td>
<td><input type="button" value="POST" onclick="ajout()"></td>
</tr>
</table>
 
<br><br>
 
</div>
 
</body>
</html>