# Update Ajax RJS problem link\_to\_function

**URL:** <https://www.ruby-forum.com/t/update-ajax-rjs-problem-link-to-function/154211>\
**Category:** Rails\
**Created:** [November 26, 2008, 12:56pm UTC](https://www.ruby-forum.com/t/update-ajax-rjs-problem-link-to-function/154211 "2008-11-26T12:56:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![vlain](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/f17d59/32.png) [@vlain](https://www.ruby-forum.com/u/vlain)\
**Post date:** [November 26, 2008, 12:56pm UTC](https://www.ruby-forum.com/t/update-ajax-rjs-problem-link-to-function/154211/1 "2008-11-26T12:56:39Z")

</div>

Hello to all.  
I use ajax tabs (rails redux)  
[http://actsasflinn.com/Ajax\_Tabs/index.html](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’

---

<div class="post-metadata">

**Author:** ![vlain](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/f17d59/32.png) [@vlain](https://www.ruby-forum.com/u/vlain)\
**Post date:** [November 26, 2008, 1:56pm UTC](https://www.ruby-forum.com/t/update-ajax-rjs-problem-link-to-function/154211/2 "2008-11-26T13:56:01Z")

</div>

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