Ajax application only works if Firebug is running

20 views
Skip to first unread message

IanW

unread,
Jul 10, 2007, 6:37:32 AM7/10/07
to Firebug
Hi,

As part of a larger application we are developing a client Support
Center and using Ajax calls to populate the screens.

The system works in IE6 / 7 but in Firefox 2.0.0.4 (and 1.5) the Ajax
calls using POST don't respond.

Having installed Firebug (1.0.5) to try and debug the problems we find
that the system works if Firebug is enabled before loading the webpage
- looking at the Net tab shows the expected Post and Response data.

If Firebug is disabled whilst the page is loading the page does not
work, and if FireBug is then enabled it displays a blank POST for all
Ajax calls.

Any thoughts?

The function codes are:-

function doAjax(fn, var1, var2, var3, var4, var5)
{
xmlHttp = GetXmlHttpObject();
if (xmlHttp == null)
{
alert ("Browser does not support HTTP Request");
return;
}
var url = 'https://<%=request.servervariables("SERVER_NAME")%>/Secure/
Support/SupportCentreAJAX.asp';
var postdata = 'ID=<%=SetPageSessionID(54494, DestFrame)%>&SV=<
%=SessionVarsID%>&S=<%=DestFrame%>&D=<%=PopupWindow1%>&AG=<%=AgencyID
%>';
postdata = postdata + '&fn=' + fn + '&var1=' + var1 + '&var2=' + var2
+ '&var3=' + var3 + '&var4=' + var4 + '&var5=' + var5;
AJAXFunc = fn;
xmlHttp.onreadystatechange = stateChanged;
xmlHttp.open("POST",url,false);
xmlHttp.setRequestHeader('Content-type','application/x-www-form-
urlencoded');
xmlHttp.send(postdata);
}

function GetXmlHttpObject()
{
var objXMLHttp = null;
if (window.XMLHttpRequest)
{
objXMLHttp = new XMLHttpRequest();
}
else if (window.ActiveXObject)
{
objXMLHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
return objXMLHttp;
}

IanW

unread,
Jul 10, 2007, 8:42:00 AM7/10/07
to Firebug
Oh the problems of Cut and Paste ! Issue is solved; the line
"xmlHttp.open("POST",url,false);" should of course read
"xmlHttp.open("POST",url,true);"

Interested to know why IE didn't fall over it though - Cue for much
anti M$ propoganda??

If you've read this far then sorry for wasting your time

Ian


Reply all
Reply to author
Forward
0 new messages