Me, Ajax and Firefox

calendar Posted on January 4, 2006   comments 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.
Firefox Ajax Fun

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 Tags: , , ,

Related Posts Possibly Related Posts

Comments

15 Responses to “Me, Ajax and Firefox”

  1. Rich G. on January 4th, 2006 9:51 pm

    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?

  2. chris on January 5th, 2006 3:24 pm

    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.

  3. kenneth papa on March 26th, 2006 7:59 pm

    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);

  4. Josh on July 25th, 2006 10:34 am

    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.

  5. Internet User on November 4th, 2006 6:07 pm

    Josh,

    After looking 3 hrs on the internet, I came across this site. A simple “GET” request got rid of the error.

    THANK YOU

  6. warren on November 22nd, 2006 11:02 am

    I’m having the same problem, only switch the method to GET didn’t solve it for me. =(

  7. Chris on November 22nd, 2006 11:48 am

    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

  8. R on November 24th, 2006 6:42 am

    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!

  9. R on November 24th, 2006 10:21 am

    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!

  10. Chris on November 24th, 2006 10:25 am

    Good stuff, “R”. Thanks for the follow-up. :-)

  11. Another Chris on December 4th, 2006 8:49 am

    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.

  12. Howard on July 25th, 2007 5:31 pm

    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!

  13. CamDQ on September 23rd, 2007 9:36 pm

    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);

  14. PumliCZ on November 20th, 2007 7:51 am

    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);

  15. WillT on January 15th, 2008 2:26 am

    xmlhttprequest seems not to like sending nulls with a POST.

    Try changing xmlhttprequest.send(null);
    to xmlhttprequest.send(”);

    This worked for me.

Leave a Reply




Have you read the Comments section on the Disclaimer page?

About

Wandering the Internet, looking at all things bright and shiny. Playing with many, writing about some. More …

Recent Posts

Recent Comments: