Comunitatea PHP Romania
MightyDeals

Prima pagină Web Librarii Javascript xmlhttp IE8

xmlhttp IE8

Discutii legate de AJAX, jQuery, MooTools, Prototype, Dojo, Yahoo! UI Library, Ext, script.aculo.us

Mesaj Mie Apr 13, 2011 11:08 am
xcvxc PHPRomania Supporter

Mesaje: 8
Salut

Am un select care la on change intrun div arata un formular dintro pagina .php prin xmlhttqrequest.
Scriptul functioneaza in toate browserele mai putin IE 8(restu IE nu leam incercat)

In afara de faptul ca prima data cand schimb select-ul glisarea e cam brusca, functioneaza bine in FF, Opera si Chrome.

La schimbarea select se apeleaza formular();

La * IE zice ca Object does not support this property or method.



$(document).ready(function(){
   $('div#form').hide();
});

frm = "";

function getFormular(str)
{
   q=1;
if (window.XMLhttqRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttq=new XMLhttqRequest();
  }
else
  {// code for IE6, IE5
  xmlhttq=new ActiveXObject("Microsoft.XMLhttq");
  }
xmlhttq.onreadystatechange=function()
  {
  if (xmlhttq.readyState==4 && xmlhttq.status==200)
    {
------>*frm = xmlhttq.responseText;
    }
  }
xmlhttq.open("GET","form/form.php?q="+str,true);
xmlhttq.send();


formRefresh();
arataFormular();

}


function arataFormular()
{

   $('#form').slideUp(1000);
   setTimeout("formRefresh()",1000);
   $('#form').slideDown(1000);
}

function formRefresh()
{
   document.getElementById("form").innerHTML = frm;
}

function formular()
{
   a = document.getElementById('categorie').value;
   if(a!="")
   {
      getFormular(a);
   }
}

Mesaj Mie Apr 13, 2011 7:52 pm
Quber Avatar utilizator
Senior Member

Mesaje: 874
Localitate: localhost

imi cer scuze dar nu intzeleg la ce te complici asa tare??? ai instalat jQuery citeste cum se foloseste la el Ajax, si cred ca vei rezolva si problema ta!! :)
A man who dares to waste one hour of time has not discovered the value of life.

Mesaj Mie Apr 13, 2011 8:46 pm
xcvxc PHPRomania Supporter

Mesaje: 8
Pai nu stiu javascript, ce fac e dupa "ureche".
Faza e ca functioneaza in toate doar in IE nu.

Mesaj Mie Apr 13, 2011 10:27 pm
dechim Senior Member

Mesaje: 1486
Localitate: Drobeta Turnu Severin
Cred ca nu incarci OCX-ul corespunzator
   try
   {
      xmlHttq = new XMLHttpRequest();
   }
   catch (e)
   {
       try
       {
          xmlHttq = new ActiveXObject("Msxml2.XMLHTTP");
         }
         catch (e)
         {
         xmlHttq = new ActiveXObject("Microsoft.XMLHTTP");
         }
    }
    
   if (xmlHttq == null)
   {
       alert ("Acest browser nu suporta HTTP Request");
       return ;
   }

"Microsoft.XMLHTTP" s-ar putea sa aibe proprietatea "responseBody" nu "responseText" (nu sunt sigur de afirmatie, trebuie citit pe site-ul Microsoft).
Inlocuieste codul la tine in functie, va merge.

Mesaj Sâm Apr 16, 2011 7:38 pm
xcvxc PHPRomania Supporter

Mesaje: 8
Merci, functioneaza.

Mesaj Dum Apr 14, 2013 12:55 am
Google Bot New Member

Mesaje: 1

Înapoi la Librarii Javascript

Copyright © 2001-2013 PHP Romania Gazduire web | Haine online | Gazduire web | Campanii SMS | Gazduire Claus Web | Inregistrare Domenii | Anunturi | Jocuri cu bile
Furnizat de phpBB® Forum Software © phpBB Group
Translation/Traducere: phpBB România
Powered by Simplis