[AJAX] code en javascript et php qui fonctionne sous FF et pas sous IE
Salut,
mon code javascript php, fonctionne sous FF et ne fonctionne bizarrement pas sous IE :(
je ne sais plus d'ou vient le probleme, je me suis dis peu être le javascript, mais bon, le code je l'utilise plusieurs fois et ça ne me causait pas trop de problemes, bon assez parler, en bref le code que j'utilise permet de supprimer une ligne, envoie de requete réussi..etc reception de données, ça s'envoie,
tout est nickel sous FF, je souligne ça s'envoie aussi sous IE, mais l'erreur d'ou vient?
aucune idée:(
ben le code, c'est pas très beau à voir >_<
mais bon, il faut montrer tout pour voir d'ou peut venir ce probleme,
sinon, je me contente que ça fonctionne sur FF, ..je dirais (voilà pour tout traitement...il faut passer par FF arf)
la page qui contient les données à afficher :
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 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
| <?php
// _______________Divya________________
include('../Library/head.php');
?>
<center>
<div id="contenu">
<div id="wrap_auth">
List des commandes
<center>
<div id="l">
<table class='table1' cellspacing="0" id='Orders' >
<tr>
<th>ID commande</th>
<th>Statut</th>
<th>ID client</th>
<th>Responsable</th>
<th>Adresse</th>
<th>Pays</th>
<th>Ville</th>
<th>Mobile</th>
<th>Email</th>
<th>Montant</th>
<th><img src="../styles/ico/b_edit.png"></th>
<th><img src="../styles/ico/b_drop.png" /></th>
</tr>
<?php
include('../Library/connection.php');
$cx=new connection();
$cx->SignIn();
$cx->RequestData("select * from command");
$result=$cx->ResultData();
foreach($result as $key)
{
echo'<tr id="line_style'.$key['ID_Order'].'" class=\'line_style_ie\'
onmouseover="Show_style(\'line_style'.$key['ID_Order'].'\');"
onmouseout="Show_style(\'line_style'.$key['ID_Order'].'\');" >
<td onclick="Show_info(\'info'.$key['ID_Order'].'\');" >'.$key['ID_Order'].'</td>
<td onclick="Show_info(\'info'.$key['ID_Order'].'\');">'.$key['Statut'].'</td>
<td onclick="Show_info(\'info'.$key['ID_Order'].'\');">'.$key['Id_customer'].'</td>
<td onclick="Show_info(\'info'.$key['ID_Order'].'\');">'.$key['Responsible'].'</td>
<td onclick="Show_info(\'info'.$key['ID_Order'].'\');">'.$key['Address'].'</td>
<td onclick="Show_info(\'info'.$key['ID_Order'].'\');">'.$key['Country'].'</td>
<td onclick="Show_info(\'info'.$key['ID_Order'].'\');">'.$key['City'].'</td>
<td onclick="Show_info(\'info'.$key['ID_Order'].'\');">'.$key['Mobile'].'</td>
<td onclick="Show_info(\'info'.$key['ID_Order'].'\');">'.$key['Email'].'</td>
<td onclick="Show_info(\'info'.$key['ID_Order'].'\');">'.$key['Amount_order'].'</td>
<td><a href="EditOrder.php?id_order='.$key['ID_Order'].'">
<img src="../styles/ico/b_edit.png"></a></td>
<td><a href="#" id_order="'.$key['ID_Order'].'"
onClick="DeleteOrder(this.getAttribute(\'id_order\'));" >
<img src="../styles/ico/b_drop.png" /></a></td>
</tr>
<tr height="0px">
<td colspan="12">
<iframe id="info'.$key['ID_Order'].'" class="hideit" src="ShowAll.php?id_order='.$key['ID_Order'].'" width="100%">
</iframe></td> </tr>
';
}
?>
</table>
</dv>
</center>
</div>
</div>
</center>
</body> |
la page ou se trouve le resultat du traitement :
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 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 85 86 87 88 89
| <table class='table1' cellspacing="0" id='Orders' >
<tr>
<th>ID commande</th>
<th>Statut</th>
<th>ID client</th>
<th>Responsable</th>
<th>Adresse</th>
<th>Pays</th>
<th>Ville</th>
<th>Mobile</th>
<th>Email</th>
<th>Montant</th>
<th><img src="../styles/ico/b_edit.png"></th>
<th><img src="../styles/ico/b_drop.png" /></th>
</tr>
<?php
include('../Library/connection.php');
$cx=new connection();
$cx->SignIn();
$cx->RequestData("select ID_Order,ID_Domain from plan_domain where ID_Order=".$_POST['ID_Order']);
$n_d=$cx->NumberRow();
$cx->RequestData("select ID_Order,ID_type_host from hosting_plan where ID_Order=".$_POST['ID_Order']);
$n_h=$cx->NumberRow();
if($n_d>0)
{
$cx->RequestData("Delete from plan_domain where ID_Order=".$_POST['ID_Order']);
}
if($n_h>0)
{
$cx->RequestData("Delete from hosting_plan where ID_Order=".$_POST['ID_Order']);
}
$cx->RequestData("Delete from command where ID_Order=".$_POST['ID_Order']);
// afficher de nouveau
$cx=new connection();
$cx->SignIn();
$cx->RequestData("select * from command");
$result=$cx->ResultData();
foreach($result as $key)
{
echo'<tr id="line_style'.$key['ID_Order'].'" class=\'line_style_ie\'
onmouseover="Show_style(\'line_style'.$key['ID_Order'].'\');"
onmouseout="Show_style(\'line_style'.$key['ID_Order'].'\');" >
<td onclick="Show_info(\'info'.$key['ID_Order'].'\');" >'.$key['ID_Order'].'</td>
<td onclick="Show_info(\'info'.$key['ID_Order'].'\');">'.$key['Statut'].'</td>
<td onclick="Show_info(\'info'.$key['ID_Order'].'\');">'.$key['Id_customer'].'</td>
<td onclick="Show_info(\'info'.$key['ID_Order'].'\');">'.$key['Responsible'].'</td>
<td onclick="Show_info(\'info'.$key['ID_Order'].'\');">'.$key['Address'].'</td>
<td onclick="Show_info(\'info'.$key['ID_Order'].'\');">'.$key['Country'].'</td>
<td onclick="Show_info(\'info'.$key['ID_Order'].'\');">'.$key['City'].'</td>
<td onclick="Show_info(\'info'.$key['ID_Order'].'\');">'.$key['Mobile'].'</td>
<td onclick="Show_info(\'info'.$key['ID_Order'].'\');">'.$key['Email'].'</td>
<td onclick="Show_info(\'info'.$key['ID_Order'].'\');">'.$key['Amount_order'].'</td>
<td><a href="EditOrder.php?id_order='.$key['ID_Order'].'">
<img src="../styles/ico/b_edit.png"></a></td>
<td><a href="#" id_order="'.$key['ID_Order'].'"
onClick="DeleteOrder(this.getAttribute(\'id_order\'));" >
<img src="../styles/ico/b_drop.png" /></a></td>
</tr>
<tr height="0px">
<td colspan="12">
<iframe id="info'.$key['ID_Order'].'" class="hideit" src="ShowAll.php?id_order='.$key['ID_Order'].'" width="100%">
</iframe></td> </tr>
';
}
echo'</table>';
/*
ob_end_clean();
$host = $_SERVER['HTTP_HOST'];
$url = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
$page = 'Orders.php';
header("Location: http://$host$url/$page");
exit;
*/
?> |
et le fichier javascript qui contient les deux fonctions
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 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
| function GetXmlHttp()
{
var xmlhttp;
try
{
if(window.XMLHttpRequest)
{
xmlhttp=new XMLHttpRequest();
// alert("it's FF");
}
else
{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
// alert("it's IE");
}
}
catch(e)
{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
if(!xmlhttp)
{
//alert("this browser doesn't provide ActiveXObject");
return false;
}
return xmlhttp;
}
function DeleteOrder(id)
{
var xhr=new GetXmlHttp();
if(confirm("Voulez vous vraiment supprimer cet enregistrement?"))
{
xhr.open('POST','DeleteOrder.php',true);
xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
xhr.send('ID_Order='+id);
xhr.onreadystatechange=function()
{
if( xhr.readyState==4 && xhr.status==200)
{
var result=xhr.responseText;
// alert(result);
document.getElementById('Orders').innerHTML=result;
}
}
}
else
{
return false;
}
} |
bon je poste tout là parce que, vraiment aucune idée d'ou ça peut venir, et puis peu etre qu'il ya d'autre erreur ou...façon de faire à corriger :).
Merci