Connecting Tech Pros Worldwide Help | Site Map

Crossbrowser Ajax - PRB: .responseText

 
LinkBack Thread Tools Search this Thread
  #1  
Old August 27th, 2008, 02:55 PM
par7133
Guest
 
Posts: n/a
Default Crossbrowser Ajax - PRB: .responseText

Hi,
Yea, XMLHttpRequest give out a crossbrowser problem managing the
status change of the connection.

Here the solution:

var xmlhttp;
xmlhttp=null;



xmlhttp=new XMLHttpRequest();



if (xmlhttp!=null)
{
if (document.all) {
//THE PROBLEM



xmlhttp.onreadystatechange=state_Change;
xmlhttp.open("GET",url,false);
xmlhttp.send(null);



function state_Change()
{
if (xmlhttp.readyState==4)
{// 4 = "loaded"
if (xmlhttp.status==200)
{// 200 = "OK"
response = xmlhttp.responseText;
}
else
{
// Problem retrieving data
}
}
}



if (response!="") {
// JSON code to manage the response

}



} else {



xmlhttp.open("GET",url);
xmlhttp.send(null);
xmlhttp.onreadystatechange=function ()
{
if (xmlhttp.readyState==4)
{// 4 = "loaded"
if (xmlhttp.status==200)
{// 200 = "OK"
response = xmlhttp.responseText;

if (response!="") {
// JSON code to manage the response
}

}
else
{
// Problem retrieving data
}
}
}



}

}
else
{
// Problem with XMLHTTP
}


Hope this helps,

http://blog.daniele.bonini.name/inde...-responsetext/

  #2  
Old August 27th, 2008, 07:25 PM
Gregor Kofler
Guest
 
Posts: n/a
Default Re: Crossbrowser Ajax - PRB: .responseText

par7133 meinte:
Quote:
Hi,
Yea, XMLHttpRequest give out a crossbrowser problem managing the
status change of the connection.
>
Here the solution:
["solution" aka crap snipped]
Quote:
Hope this helps,
Whom? Why? And: No.

Gregor


--
http://photo.gregorkofler.at ::: Landschafts- und Reisefotografie
http://web.gregorkofler.com ::: meine JS-Spielwiese
http://www.image2d.com ::: Bildagentur für den alpinen Raum
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.