AJAX Insertion.Before


#1

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.


#2

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

search for “Insertion.Before” in the page


#3

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 H.
To: removed_email_address@domain.invalid
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 W. removed_email_address@domain.invalid 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
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails


Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails


#4

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:

bar

and my remote link returned “foo”

the result would be:

foobar

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

Add

however, as tables have been known to be flaky across browsers in
regards to
ajax, I have no idea if this would even work.