SitePoint Sponsor |
|
User Tag List
Results 1 to 8 of 8
-
Sep 25, 2008, 04:54 #1
- Join Date
- Mar 2008
- Posts
- 129
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
AJAX calls not working in new version of Firefox
Is this happening to anyone else? In Safari, IE and previous version of FF all my calls work fine but when I upgrade to the new Firefox, it "hangs". The calls are made, but nothing is returned to the screen.
-
Sep 25, 2008, 08:29 #2
- Join Date
- Apr 2007
- Posts
- 1,205
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
On POST requests or GET requests? FF 3.0.x fires the onload event instead of onreadystatechange for synchronous POST requests. Just because they can, I guess.
EDIT: Here's some workaround code:
Code:if ((xhr.async == false) && (navigator.userAgent.indexOf('Gecko') != -1)) xhr.onload = function() {handleResponse();}; else xhr.onreadystatechange = function() {handleResponse();};
-
Sep 25, 2008, 08:45 #3
- Join Date
- Mar 2008
- Posts
- 129
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Thanks for the snippet, but where does it go?
In this block:
xmlHttp.onreadystatechange = function()
{
if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete")
{
eval(myFunc2) (xmlHttp.responseXML,thisID,thisTagName);
}
}
I assume the xhr is the xmlHTTP object, right?
-
Sep 25, 2008, 09:02 #4
- Join Date
- Apr 2007
- Posts
- 1,205
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
-
Sep 25, 2008, 11:43 #5
- Join Date
- Mar 2008
- Posts
- 129
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
This still isn't working. Here is what I've done.
BEGIN OLD Code
xmlHttp.onreadystatechange = function()
{
if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete")
{
eval(myFunc2) (xmlHttp.responseXML,thisID,thisTagName);
}
}
END Old Code
New Code
if ((xmlHttp.async == false) && (navigator.userAgent.indexOf('Gecko') != -1))
xmlHttp.onload = function()
{
if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete")
{
eval(myFunc2) (xmlHttp.responseXML,thisID,thisTagName);
}
}
else
xmlHttp.onreadystatechange = function()
{
if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete")
{
eval(myFunc2) (xmlHttp.responseXML,thisID,thisTagName);
}
}
END new Code
I'm missing something but I don't know what....
-
Sep 25, 2008, 11:50 #6
- Join Date
- Mar 2008
- Posts
- 129
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
The responseXML above is responseText....
-
Sep 25, 2008, 11:50 #7
- Join Date
- Apr 2007
- Posts
- 1,205
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Okay, I gather your problem has nothing to do with FF using the onload event for synchronous POST requests then. I'll need to see the full context to determine what else is at play here.
-
Sep 25, 2008, 12:08 #8
- Join Date
- Mar 2008
- Posts
- 129
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Well, that'll teach me to cut and paste. I had two functions, one for XML and one for HTML and the eval() was sending parms for XML call.
I got it working. Thanks for your help....
Bookmarks