Update Ajax RJS problem link_to_function


#1

Hello to all.
I use ajax tabs (rails redux)
http://actsasflinn.com/Ajax_Tabs/index.html.
I have 2 simple tab (“All” and “Favorites”). As default “All” is
selected, when I click “Favorites” request is correct and there is the
render of rjs but I obtain the classic error:

… try { Element.update(“favorites_pane”, "\n \n \n … and so on…

If I change div and I put it before the div panecontrol1 all is ok.
Code of loadPane method, tabselect and paneselect is on Flinn blog (I
change only li element with div element).


This is the view

  • <%= link_to_function('All', "tabselect($('all_tab')); paneselect($ ('all_pane'))") %>
  • <%= link_to_function('Favorites', "loadPane($('favorites_pane'), '" + url_for(:action => 'favorites') + "'), tabselect($('favorites_tab')); paneselect($ ('favorites_pane'))") %>
<%= render :partial => 'forum/forum'%>
------------------------------------------------------- This is favorites.js.rjs

page.replace_html “favorites_pane”, :partial => ‘shared/xxx’


#2

Sorry, I found the solution. Simply I was looking in the wrong place
(a little break was useful).

Update in the Ajax is the error, change with Ajax.Request in the the
method reloadPane solves the problem:

new Ajax.Request(src,
    {asynchronous:1, evalScripts:true, onLoading:function(request)

{pane.innerHTML=waiting_pane}}
)