Jonas Raoni ha scritto:
Randy Webb escreveu:
kd****@gmail.co m said the following on 11/20/2006 8:49 PM:
[...]
And if you are running it locally the readyState will never be 200.
Also checking for the constant "200" isn't nice in my opinion, because
what defines the status is just the first digit of the code, the others
act as a kind of sub-status.
--
Jonas Raoni Soares Silva
http://www.jsfromhell.com
Thanks a lot buddies.
It's quite clear to me.
But I also found this Ajax library
and to check the status it's use
a boolean var.
function XHConn()
{
var xmlhttp, bComplete = false;
try { xmlhttp = new ActiveXObject(" Msxml2.XMLHTTP" ); }
catch (e) { try { xmlhttp = new ActiveXObject(" Microsoft.XMLHT TP"); }
catch (e) { try { xmlhttp = new XMLHttpRequest( ); }
catch (e) { xmlhttp = false; }}}
if (!xmlhttp) return null;
this.connect = function(sURL, sMethod, sVars, fnDone)
{
if (!xmlhttp) return false;
bComplete = false;
sMethod = sMethod.toUpper Case();
try {
if (sMethod == "GET")
{
xmlhttp.open(sM ethod, sURL+"?"+sVars, true);
sVars = "";
}
else
{
xmlhttp.open(sM ethod, sURL, true);
xmlhttp.setRequ estHeader("Meth od", "POST "+sURL+" HTTP/1.1");
xmlhttp.setRequ estHeader("Cont ent-Type","applicat ion/x-www-form-urlencoded");
}
xmlhttp.onready statechange = function(){
//HERE -------------!bComplete-------------
if (xmlhttp.readyS tate == 4 && !bComplete)
{
bComplete = true;
fnDone(xmlhttp) ;
}};
xmlhttp.send(sV ars);
}
catch(z) { return false; }
return true;
};
return this;
}
var myConn = new XHConn();
if (!myConn) alert("XMLHTTP not available. Try a newer/better
browser.");
var fnWhenDone = function (pXML) { alert(pXML.resp onseText); };
myConn.connect( "test.txt", "GET","",fnWhen Done);
Is it the same case or not ?
Bye.