Forum: Ruby on Rails AJAX Insertion.Before

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
2b891e820c238ded365d035771603f21?d=identicon&s=25 Bill Walton (Guest)
on 2006-04-03 18:54
(Received via mailing list)
Can anyone point me to an example of how to use the Insertion.Before
technique?  I've just begun trying to use AJAX and worked through Curt's
"Ajax on Rails".  The description in AWD of what this does is just what
I need, there's no example of how to use it, and I'm getting no joy
using Google.  Any help is tremendously appreciated.
A2c85dc5ee81b12e3cc0a6522e8d079d?d=identicon&s=25 Chris Hall (Guest)
on 2006-04-03 19:15
(Received via mailing list)
http://www.sergiopereira.com/articles/prototype.js.html

search for "Insertion.Before" in the page
2b891e820c238ded365d035771603f21?d=identicon&s=25 Bill Walton (Guest)
on 2006-04-03 19:49
(Received via mailing list)
Hi Chris,

I appreciate your response.  I'd found that through Google but there's
no example of how I'd use it in Rails.  Curt's "Ajax on Rails" article
works great with lists, but I can't get it to do much of anything good
with tables. ;-(  Despite all the praise I've seen for how easy Rails
makes Ajax, I can't find much in the way of examples / tutorials.

Thanks again,
Bill
  ----- Original Message -----
  From: Chris Hall
  To: rails@lists.rubyonrails.org
  Sent: 2006-04-03 12:14 PM
  Subject: Re: [Rails] AJAX Insertion.Before


  http://www.sergiopereira.com/articles/prototype.js.html

  search for "Insertion.Before" in the page


  On 4/3/06, Bill Walton <bill.walton@charter.net> wrote:
    Can anyone point me to an example of how to use the Insertion.Before
technique?  I've just begun trying to use AJAX and worked through Curt's
"Ajax on Rails".  The description in AWD of what this does is just what
I need, there's no example of how to use it, and I'm getting no joy
using Google.  Any help is tremendously appreciated.

    _______________________________________________
    Rails mailing list
    Rails@lists.rubyonrails.org
    http://lists.rubyonrails.org/mailman/listinfo/rails







------------------------------------------------------------------------------


  _______________________________________________
  Rails mailing list
  Rails@lists.rubyonrails.org
  http://lists.rubyonrails.org/mailman/listinfo/rails
A2c85dc5ee81b12e3cc0a6522e8d079d?d=identicon&s=25 Chris Hall (Guest)
on 2006-04-03 20:20
(Received via mailing list)
without knowing exactly what you want to do, i can only provide a simple
example.  hopefully this is what you are after.

<%= link_to_remote( "Add", :update => "xyz", :url => { :action => "add"
},
:position => "before") %>

what this will accomplish is to call the add action on the controller
and
then insert the returned content before the element with the id of "xyz"

so if i had the following as my update element:

<span id="xyz">bar</div>

and my remote link returned "foo"

the result would be:

foo<span id="xyz">bar</span>

if you were to look at the source, you would see something like:

<a href="#" onclick="new Ajax.Updater('xyz', '/controller/add',
{asynchronous:true, evalScripts:true, insertion:Insertion.Before});
return
false;">Add</a>

however, as tables have been known to be flaky across browsers in
regards to
ajax, I have no idea if this would even work.
This topic is locked and can not be replied to.