Can we add "append to destination html" support for Link_to

13 views
Skip to first unread message

Gianna Giavelli

unread,
Apr 11, 2015, 5:05:28 AM4/11/15
to acti...@googlegroups.com
Currently:

Example 2: Ajax link, sets data to destination element

<@link_to controller="books" action="fetch" destination="result">Get Books</@>

So if I have 
    <div id="result">stuff</div>
I would get
    <div id="result">result</div>

I would like to instead APPEND the result to the content of the div. My suggestion is to use a flag "appendtodestination" for example:
<@link_to controller="books" action="fetch" destination="result" appendtodestination="true">Get Books</@>
    results in:
         <div id="result">stuff result</div>

This makes many operations much simpler. So while this is a feature request is there an easy way without doing my own jquery code to do this now?

Igor Polevoy

unread,
Apr 14, 2015, 12:05:17 AM4/14/15
to acti...@googlegroups.com
Hi, Gianna, this should be easy. Since the aw.js script is part of your project, you can use this: http://api.jquery.com/appendto/
to do what you need. 

tx
Reply all
Reply to author
Forward
0 new messages