Bonjour à tous ;
je souhaiterai voir et essayer l'utilité d'ajax ;ainsi je souhaite mettre ajax sur ma pagination , elle marche correctement sur de simple code php mais pour mettre ajax avec je ne sais pas faire comment voici le code pour la pagination en bas :
donc si j'ai bien compris si on clique sur le a contenu dans #pagination
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4 <div class="grid_12"> <span id="pagination"><div id="pagination"> <strong>1</strong> <a href="http://localhost/MonSite/index.php/annonce/afficherAnnonce/4">2</a> <a href="http://localhost/MonSite/index.php/annonce/afficherAnnonce/8">3</a> <a href="http://localhost/MonSite/index.php/annonce/afficherAnnonce/4">>></a> </div></span> </div>
je peux l'envoyer ou relier avec ajax :
pour ajax j'ai écrit le code basique :
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
29
30
31
32
33
34
35
36
37
38
39
40 <script type="text/javascript"> function loadXMLDoc() { var xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("#pagination").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","?????",true); xmlhttp.send(); } </script> sur leje ne sais pas trop mettre sur le 2eme paramètre et aussi ici
Code : Sélectionner tout - Visualiser dans une fenêtre à part xmlhttp.open("GET","?????",true);merci
Code : Sélectionner tout - Visualiser dans une fenêtre à part document.getElementById("#pagination").innerHTML=xmlhttp.responseText;
Partager