profug0
11-06-2007, 04:39 PM
I hope somebody can tell me why this is happening...
I'm calling the following:
var raw_css = request_lite('?page=get_css', returnData);
When I check the value of 'response1' inside the 'request_lite' function, it is correct, but when it is returned to the 'raw_css' variable it is 'undefined'.
This only occurs in Internet Explorer, obviously. Somebody please help!!
function request_lite(url, writeFunction, div)
{
if (ajax)
{
// Navigate the application window
var response;
var response1;
ajax.open('get', 'switchboard.php' + url);
ajax.onreadystatechange = function ()
{
if ((ajax.readyState == 4) && (ajax.status == 200))
{
response = writeFunction(ajax, div);
response = String(response);
if (response != undefined && response != 'undefined')
{
response1 = response;
}
}
}
ajax.send(null);
return response1;
}
}
// Function used by request_page() to write to the specified div
function writeDiv(ajax, div)
{
document.getElementById(div).innerHTML = ajax.responseText;
}
// Function used by request_page() to pass info to array
function returnData(ajax, nothing)
{
var response = ajax.responseText;
return response;
}
I'm calling the following:
var raw_css = request_lite('?page=get_css', returnData);
When I check the value of 'response1' inside the 'request_lite' function, it is correct, but when it is returned to the 'raw_css' variable it is 'undefined'.
This only occurs in Internet Explorer, obviously. Somebody please help!!
function request_lite(url, writeFunction, div)
{
if (ajax)
{
// Navigate the application window
var response;
var response1;
ajax.open('get', 'switchboard.php' + url);
ajax.onreadystatechange = function ()
{
if ((ajax.readyState == 4) && (ajax.status == 200))
{
response = writeFunction(ajax, div);
response = String(response);
if (response != undefined && response != 'undefined')
{
response1 = response;
}
}
}
ajax.send(null);
return response1;
}
}
// Function used by request_page() to write to the specified div
function writeDiv(ajax, div)
{
document.getElementById(div).innerHTML = ajax.responseText;
}
// Function used by request_page() to pass info to array
function returnData(ajax, nothing)
{
var response = ajax.responseText;
return response;
}