J'ai pu avancer, le fichier ajax-coord.php est effectivement ouvert avec les paramètres, mais j'ai toujours un pb : à aucun moment je ne me retrouve dans la condition
if(xhr.readyState == 4 && xhr.status == 200)
Quand je lance la fonction, j'obtiens une alerte (
alert(xhr.readyState + " - " + xhr.status
)) avec "4 - 0" - mais jamais je n'obtiens le 'ok'.
D'où cela peut venir ?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| function AfficheCoordonnees(idClient, idAgent){
var xhr = getXhr();
xhr.open("POST","../php/ajax-coord.php",true);
xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
xhr.send("idClient="+idClient+"&idAgent="+idAgent);
xhr.onreadystatechange = function()
{
alert(xhr.readyState + " - " + xhr.status);
if(xhr.readyState == 4 && xhr.status == 200)
{
alert('ok');
}
}
} |
Partager