P
par7133
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/index.php/2008/08/27/crossbrowser-ajax-prb-responsetext/
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/index.php/2008/08/27/crossbrowser-ajax-prb-responsetext/