Tema: Re: PHP ajax slectbox
Autorius: Laimis
Data: 2012-02-06 17:17:38
lens rašė:

> function getXMLHTTP() { //fuction to return the xml http object
>    var xmlhttp=false;
>    try{
>     xmlhttp=new XMLHttpRequest();
>    }
>    catch(e) {
>     try{
>      xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
>     }
>     catch(e){
>      try{
>       xmlhttp = ActiveXObject("MSXML2.XMLHTTP.3.0");
>      }
>      catch(e1){
>       xmlhttp=false;
>      }
>     }
>    }
>
>    return xmlhttp;
>      }


Painu čia ir apskritai. Daugelyje vietų, pasak MS XML komandos nario,
neteisingai/bereikalingai stengiamasi naudoti Microsoft.XMLHTTP, nes jis 
reiškia _legacy_ MSXML3:
„MSXML2 vs. Microsoft namespace – I’ve also seen a lot of code that 
instantiates the “Microsoft.XMLHTTP” ActiveX object rather than the 
MSXML2.XMLHTTP.3.0 or MSXML2.XMLHTTP.6.0 if you’re using 6.0.  The 
“Microsoft” namespace is actually older and is only implemented in 
MSXML3 for legacy support.  It’s unfortunate we used the “better” name 
on the older version, but stick to the “msxml2” namespace when 
instantiating objects.“

Kita vertus, IE7 native XMLHttpRequest, kaip suprantu, yra šleivas.
Trečia vertus, egzistuoja aibė kitų IE klaidų ir kliurkų.

Todėl yra ir tai:
http://code.google.com/p/xmlhttprequest/

Bet kokiu atveju, visuomet naudok encodeURIComponent().

O šiaip, laikas jau dairytis į jQuery ir/ar pan.