views:

129

answers:

2

Hi all i am writing a Rails application and i include some link_to_remote links The generated code is

<a href="#" onclick="new Ajax.Request('/b10/categories/games?category=Action', {asynchronous:true, evalScripts:true}); return false;">Test</a>

That works perfectly fine on Safari and Firefox but when i try to click the link on IE7 and Opera it does not even hit the server.

Any hints ?

+1  A: 

Hi mate,

This is a bad practice to include all of this code in the <a href> tag anyways. I suggest you make a function such as:

function doAjax(url)
{
   new Ajax.Request(url, {asynchronous:true, evalScripts:true});
   return false;
}

in the javascript code. And change the url to say instead:

<a href="#" onclick="return doAjax('/b10/categories/games?category=Action');">
Test</a>
Click Upvote
+1  A: 

Use a fully qualified URL: http://.....

Diodeus
+1 to that too, do that in addition to my solution above
Click Upvote