Précédent   Forum des professionnels en informatique > Webmasters - Développement Web > AJAX
AJAX Forum sur la programmation AJAX. Avant de poster : Cours AJAX, FAQ AJAX, Toutes les FAQ JavaScript
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 20/01/2008, 23h40   #1
Membre actif
 
Avatar de witch
 
Mina Essabbeur
Inscription : mai 2007
Messages : 345
Détails du profil
Informations personnelles :
Nom : Mina Essabbeur
Âge : 25

Informations forums :
Inscription : mai 2007
Messages : 345
Points : 178
Points : 178
Envoyer un message via MSN à witch
Par défaut 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
__________________
You probably have a very easy job, the kind robots will be doing soon.
witch est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 21/01/2008, 10h55   #2
Membre éprouvé
 
Avatar de d-Rek
 
Développeur Web
Inscription : janvier 2007
Messages : 438
Détails du profil
Informations personnelles :
Localisation : France, Nord (Nord Pas de Calais)

Informations professionnelles :
Activité : Développeur Web

Informations forums :
Inscription : janvier 2007
Messages : 438
Points : 400
Points : 400
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
function getXhr(){
	var xhr = null;
	if(window.XMLHttpRequest) // Firefox et autres
		xhr = new XMLHttpRequest();
	else if(window.ActiveXObject){ // Internet Explorer
		try{xhr = new ActiveXObject("Msxml2.XMLHTTP");}
		catch(e){try{xhr = new ActiveXObject("Microsoft.XMLHTTP");}catch(e){}}
	}else{ // XMLHttpRequest non supporté par le navigateur
		alert("Votre navigateur ne supporte pas les objets XMLHttpRequest...");
		xhr = false;
	}
	return xhr;
}
__________________
Mon blog
d-Rek est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 21/01/2008, 11h08   #3
Membre actif
 
Avatar de witch
 
Mina Essabbeur
Inscription : mai 2007
Messages : 345
Détails du profil
Informations personnelles :
Nom : Mina Essabbeur
Âge : 25

Informations forums :
Inscription : mai 2007
Messages : 345
Points : 178
Points : 178
Envoyer un message via MSN à witch
je ne vois pas ou est la difference d'utiliser ta façon de creer un objet XMLHttpRequest ou la mienne en fait, sans commentaire, nulle explication, c'est frustrant, mais j'ai testé tout de même, ça ne marche toujours bizarrement pas sur IE, je note que c'est pas la première fois que j'utilise cette objet, je l'utilisais plusieurs fois avec cette même fonction, et ça ne me posait pas de probleme, juste là avec ce code..etc
aucune idée
j'aimerais bien trouver ou se trouve réellement le probleme

Merci
__________________
You probably have a very easy job, the kind robots will be doing soon.
witch est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 21/01/2008, 11h11   #4
Membre éprouvé
 
Avatar de d-Rek
 
Développeur Web
Inscription : janvier 2007
Messages : 438
Détails du profil
Informations personnelles :
Localisation : France, Nord (Nord Pas de Calais)

Informations professionnelles :
Activité : Développeur Web

Informations forums :
Inscription : janvier 2007
Messages : 438
Points : 400
Points : 400
Salut, la différence est que mon code teste ActiveXObject("Msxml2.XMLHTTP") et/ou ActiveXObject("Microsoft.XMLHTTP")

Peut-être que ton soucis ne provient pas de la création de ton objet XmlHttpRequest. Poste le reste de ton code s'il te plait.
__________________
Mon blog
d-Rek est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 21/01/2008, 12h13   #5
Membre actif
 
Avatar de witch
 
Mina Essabbeur
Inscription : mai 2007
Messages : 345
Détails du profil
Informations personnelles :
Nom : Mina Essabbeur
Âge : 25

Informations forums :
Inscription : mai 2007
Messages : 345
Points : 178
Points : 178
Envoyer un message via MSN à witch
Enfin, c'est clair que ça ne vient pas de cet objet
et puis j'ai déjà posté tout le code, je me demande ce que je dois montrer encore, j'ai posté tout le code que j'utilise
__________________
You probably have a very easy job, the kind robots will be doing soon.
witch est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 05h45.


 
 
 
 
Partenaires

Hébergement Web