Ajax problem in firefox only -- any help?
Posted: Sun Oct 29, 2006 12:53 pm
Weirdan | Please use
The url that gets passed is : http://70.87.49.164/rpc.php?cmd=getSurveyData&sid=2
As you can see this does in fact return valid xml data and does so in FF.
So I cannot understand why my script is failing.
When I debug using Venkman, it seems like the xmlHttp.readystate is always 1 (loading) and never seems to get to 4.
As I said, this works fine in IE. If anyone thinks they can help and needs to see the application in action, let me know and I will create you a temporary account on the system.
I have bought an ajax book, and that has been no help as to me the code looks fine.
Thanks for any and all help/comments.
Weirdan | Please use[/syntax]
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: :arrow: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hey guys!
I am an experience developer (php5 and javascript) but I've just started to use Ajax and have come across an issue that only shows it's head in FF.
I have the following functions in a js file:
[syntax="javascript"]
var xmlHttp;
function doSurveySelect(selector, site_url)
{
survey_idx = selector[selector.selectedIndex].value;
createXMLHttpRequest();
var url = site_url + 'rpc.php?cmd=getSurveyData&sid=' + survey_idx;
xmlHttp.open('GET', url);
xmlHttp.onreadystatechange = surveyDataToForm;
try
{
xmlHttp.send(null);
}
catch(e)
{
return throwError('surv_form', e.description);
}
return;
}
function surveyDataToForm()
{
try
{
if (xmlHttp.readyState == 4)
{
if(xmlHttp.status == 200)
{
//do some error checking/handling
if(xmlHttp.responseXML.documentElement && xmlHttp.responseXML.documentElement.hasChildNodes)
{
if(xmlHttp.responseXML.documentElement.firstChild.nodeName == 'error')
{
var error_text = xmlHttp.responseXML.documentElement.firstChild.text.toString();
error_text = "XML-RPC Error: " + error_text;
return throwError('surv_form', error_text);
}
}
else
{
var error_text = "No data returned from query!";
error_text = "XML-RPC Error: " + error_text;
return throwError('surv_form', error_text);
}
//populate form with gotten values
.
.
.
.
}
}
}
catch(e)
{
return throwError('surv_form', e.description);
}
function createXMLHttpRequest()
{
if(window.XMLHttpRequest)
{
xmlHttp = new XMLHttpRequest();
}
else if(window.ActiveXObject)
{
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
if(!xmlHttp)
{
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
}
}
As you can see this does in fact return valid xml data and does so in FF.
So I cannot understand why my script is failing.
When I debug using Venkman, it seems like the xmlHttp.readystate is always 1 (loading) and never seems to get to 4.
As I said, this works fine in IE. If anyone thinks they can help and needs to see the application in action, let me know and I will create you a temporary account on the system.
I have bought an ajax book, and that has been no help as to me the code looks fine.
Thanks for any and all help/comments.
Weirdan | Please use[/syntax]
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: :arrow: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]