[AJAX] variable de fonction dans une boucle
bonjour tous le monde, je me mets a l'AJAX mais c est dur dur :D
alors voila, je voudrais mettre dans ma fonction une variable qui se situe dans une boucle dans un lien (la variable "prod"): comment faire pour la mettre dans ma fonction? parceque la, elle y va pas du tout...
mon code est le suivant :
Code:
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
| <head>
<script type="text/javascript">
<!--
function sendData() {
var xhr = getXMLHttpRequest();
if(xhr && xhr.readyState != 0) {
xhr.abort();
}
xhr.onreadystatechange = function() {
if(xhr.readyState == 4 &&
(xhr.status == 200 || xhr.status == 0)) {
getData(xhr.responseText);
}
}
xhr.open("GET", "panier4_2.php?id=" + prod + "", true);
xhr.send(null);
}
function getData(sData) {
alert(sData);
}
//-->
</script>
</head>
<table>
<!--DWLayoutTable-->
<tr>
<td><center>
ajouter
</center></td> </tr>
<?php
while($donnees=mysql_fetch_array($reponse))
{
?> <tr>
<td valign="top" ><a href="panier4_2.php?prod=<?php echo
$donnees['id'];?>
&famille=<?php echo $famille;?>&page=<?php echo $page;?>">panier</a></td>
</tr>
<?php
} ?>
</table> |
merci de bien vouloir m aider