views:

196

answers:

2

I have the following Rails link generating code

(I have removed potentially 'industry secret' stuff, sorry for the odd names, but the length of variable names and values match)

<%= link_to_remote "FOUR", :method => "get", :url => {:action => "testing01_four_log_info", :fourth_name => "LA1", :testing01_num => "123"} %>

This code generates:

new Ajax.Request('/traffic/testing01_four_log_info?testing01_num=123&fourth_name=LA1', {asynchronous:true, evalScripts:true, method:'get'});

The issue is that the link works and returns values when clicked in IE and Safari and Chrome and Opera. It does not from Firefox (Version 3.0.6). In fact the Firebug console seems to indicate that nothing is even getting sent. However, when I do click on the link the :before code (that I left out of the link_to_remote code above) does actually get executed.

So, what am I doing wrong?

EDIT: Okay, so after working on this issue more it is an issue with Firefox and how it is handling the code. I can request the URL directly from within Firefox and it will work. So it's either a bug with Firefox or a bug with my code. Duh! :) As a side note, I have run into this issue once before. In that case though it was because the URL was too long and in that case Apache wasn't happy. In this case it's Firefox that isn't happy about something.

And debugging with Wireshark shows that there ain't nothing going across the wire. Other links will go across the wire, but not this one. From Firefox only.

EDIT: Solved. Adblock Plus was the culprit. Disabling it for my site fixed the issue. Thank you Stack Overflow!

+2  A: 

When really weird things like this happen, it's time to double-check the obvious.

  • Do you have JavaScript enabled in Firefox?
  • Do you have NoScript, or anything like it, installed?
jdl
Makes sense. To answer the questions: Yes, javascript is enabled. I don't have any script blockers or anything like that installed...except for Adblock Plus. <scurries to disable on this page> AH THAT DID IT! PERFECT!
salt.racer
A: 

I had similar problem because of Firefox caching XHR responses. I had to add right HTTP headers to the response (C code was generating the response). Some worked only for IE, some for Firefox. But you said cache is not a case here. Just double check this.

Other possible case. Browsers limit number of concurrent opened connections to the server. There are only 2 possible at the same time. So if you have some not closed connections to your web server, then Firefox will wait them to finish and suspend your XHR request.

Sometimes anti-virus / local firewalls programs might cause similar problems. However it is unlikely case as your request works when loaded directly from the address bar.

If everything fails then you simply have to trace line by line Prototype lib code and see where your request is blocked. Are you sure that the Ajax code is executed as expected?

Greg Dan