[AJAX] Envois de valeur en POST
Bonjour à tous,
je suis occupé a développée un site avec de l'ajax.
j'en vois des donné en Post en PHP mais celle-ci reçoit rien.
je vois pas ou peux se trouvé le problème.
vois mon code
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>Mon premier menu AJAX</title>
<script src="bibli.js"></script>
<link href="chrome://firebug/content/highlighter.css" type="text/css" rel="stylesheet">
</head>
<body>
<table>
<tbody>
<tr>
<td>Acceuille</td>
<td><a onclick="up('parent',1,1)"><img src="/forum/adm/images/icon_up.gif"></a></td>
<td><a onclick="dow('parent',1,1)"><img src="/forum/adm/images/icon_down.gif"></a></td>
<td><a onclick="supprim(1,1)"><img src="/forum/adm/images/icon_delete.gif"></a></td>
</tr>
</tbody>
</table>
<div id="erreur"></div>
</body>
</html> |
fichier bibli.js
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 48 49 50 51 52
|
function get_Xhr()
{
var x;
if(window.XMLHttpRequest)
{
x = new XMLHttpRequest();
}
else if(window.ActiveXOject)
{
try
{
x = new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e)
{
try
{
x = new ActiveXObject("Microsoft.XMLHTTP");
}
catch(el)
{
x = null;
}
}
}
else
{
alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest\nVeuillez le mettre à jour");
}
return x;
}
function supprim( id, pos )
{
var xhr =get_Xhr();
xhr.onreadystatechange = function()
{
if(xhr.readyState == 4 && xhr.status == 200)
{
var anwer = xhr.responseText;
document.getElementById("erreur").innerHTML = anwer;
}
}
xhr.open("POST", 'gestreq.php', true);
xhr.setRequestHeader('Content-Type','x-www-form-urlencoded');
str = "fct=del";
xhr.setRequestHeader("Content-length", str.length);
xhr.setRequestHeader("Connection", "close");
xhr.send(str);
} |
fichier gestreq.php
Code:
1 2 3 4
|
<?php
print_r($_POST);
?> |
cette page retourne
firebug signale bien l'envoi des données en post.
quelqu'un aurai une idée pour résoudre mon problème?
merci bien