Hey
I am implementing a widget which will retrieve timetable infromation from a public third-party API (XML over Http GET). I started the development with IE 8 with no problems. Today I tried to run my code on Aptana / Firefox and my API requests stopped to work. Here is my code:
function test()
{
var url = "http://...;
xmlhttp = new XMLHttpRequest();
xmlhttp.open('GET', url, true);
xmlhttp.onreadystatechange = processResponse;
xmlhttp.send( null );
}
function processResponse()
{
if ( xmlhttp.readyState == 4 )
{
if ( xmlhttp.status == 200 )
{
result = xmlhttp.responseXML;
}
}
}
The code runs fine with IE but with Firefox, xmlhttp.status is always 0, xmlhttp.statusText is "OK" and xmlhttp.responseXML is null.
I can get the response returned by adding the following line
if ( window.netscape ) netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead UniversalBrowserWrite");
after the line where I create the XMLHttpRequest object. However, this does not sound like the way this issue should be tackled with.
Can somebody tell be why Firefox is behaving the way it is? Or even better, give me some hints on how to proceed?
Best Regards, kuhamobilen

Reply With Quote

