Me, Ajax and Firefox
Posted on January 4, 2006
15 Comments
[don't fear, it ended well]
Finally wandered a bit into the Ajax world today (ajax overview). Situation with a project at work lends itself nicely; and, for once, ajax no longer looks like a solution in search of a problem — I actually have a “non squirrely” reason to give it a go.
My go didn’t go so well. 7 long hours of not so well. Granted, most of those were experimenting and researching.
Oddly enough, it works wonderfully in Internet Explorer. Not so good in Firefox or Opera though. In all 3 cases my client code appears to fire the xmlHttpRequest critter just fine, so that’s good. With IE I get back a 200 (OK) and, more importantly, I can see that the database update that happens at the server side actually happens. With Firefox I get back a 411 (bad length) return code. No server side update. But, more interestingly, I’m not sure that 411 is the “real” error. The Java Console (built into Firefox) tells an odd story. Specifically, the “component returned failure code: 0×80040111″ story. Truly, a sad sad story indeed! I just don’t know if this story has a moral or not.
![]()
Did some googling on that component failure code and got a lot of weird hits. Guess I’ll dig more into that tomorrow…
I wonder though, as I ponder this, if this is related my firing off this transaction as an onChange event on an html form select tag? I suppose I should mock up some quick tests in the morning with just basic checkboxes. And speaking of wondering, I can’t help but ponder if this is an IIS6 related issue.
Tags: ajax, firefox, opera, programming
Possibly Related Posts
Comments
15 Responses to “Me, Ajax and Firefox”
Leave a Reply



And then there’s the whole… which one is doing it ‘right’? thing.. in theory you want to code for the one that is doing it the right way… in practice… do you code for the most popular browser? What do you do when you can’t do both? ARGH!!!!
See why I don’t do much webbing beyond the blog?
well the thing is, both should do this stuff just fine. I mean hell, Google Mail works in either browser, why doesn’t my piddly stuff?
Anyways.. got it sorted out this morning.
I suppose I’ll have to do the obligatory “Simple Ajax How-To” blog post soon… and since I appear to do it just a wee bit weird, perhaps I will.
I’m having the same kind of problem using an xmlhttprequest. works fine when browsing site with IE 6, but firefox is choking with a 411 length required error.
oRequest.open("post",pagetoopen,true);oRequest.setRequestHeader(”Content-Type”, “application/x-www-form-urlencoded”);
oRequest.setRequestHeader(”Content-Length”, “0″);
…
…
oRequest.send(null);
I am not sure if you have solved the problem yet, but I have experienced this problem and it was easily remedied by switching the request type from post to get. Hopefully this helps.
Josh,
After looking 3 hrs on the internet, I came across this site. A simple “GET” request got rid of the error.
THANK YOU
I’m having the same problem, only switch the method to GET didn’t solve it for me. =(
warren, I have a bit of a followup that might be worth a look: http://www.solo-technology.com/blog/2006/01/05/ajax-battle-rejoined-won
I found out that the error 80040111 only occurs when you do a:
- onsubmit in the form element
- onclick on an input element of type=”submit”
So, I guess something to do with submitting!
I found my problem!
if you don’t give a return value to onsubmit of a form, it happens!
So, for people still wioth this problem, try adding “
; return false;” behind your ajax request function.DOW!
Good stuff, “R”. Thanks for the follow-up.
Hi!
I have the same probs - i get this “80040111″ error (which I’ve fixed with a try/catch construction in my response function) and that “411″ return-code.
The weird thing about the latter error is, it works just fine on my develepment machine, but fails, when i copy the code to the web.
Hi all,
We had the same problem. We ended up using ‘GET’ specifically for Firefox and IIS6.
‘POST’ worked with Firefox and IIS5/WinNT but not IIS6/Win2003. Weird!
Solve this problem by code:
var url = “../vn/processInfo.aspx”;
var parameters = “action=3″;
parameters=encodeURI(parameters);
xmlhasVote.onreadystatechange = hasVote
xmlhasVote.open(”POST”, url, true);
xmlhasVote.setRequestHeader(”Content-type”,”application/x-www-form-urlencoded”);
xmlhasVote.setRequestHeader(”Content-length”,parameters.length);
xmlhasVote.setRequestHeader(”Connection”,”close”);
xmlhasVote.send(parameters);
Yes, i was today solving this problem too for some time. Opera and IE was running fine, FF got 411 error, when POST. GET was ok. So as written above me, there needed to send length of parameters in setRequestHeader().
ie:
param=encodeURI(param);
httpRequest.setRequestHeader(’Content-Type’, ‘application/x-www-form-urlencoded’);
httpRequest.setRequestHeader(’Content-length’, param.length);
httpRequest.send(param);
xmlhttprequest seems not to like sending nulls with a POST.
Try changing xmlhttprequest.send(null);
to xmlhttprequest.send(”);
This worked for me.