Help with link_to_remote or javascript generator

Hi all,

I’m a relative noob to rails so I apologize in advance for asking such a
basic question.

I am trying to do multiple AJAX calls using the link_to_remote helper or
the
JavaScript generator update_page. I have googled and read the docs for
both, but can’t seem to figure out exactly what i need to do.

Say I have the following html:

Insert text

When I click on the “Insert text” link I want that div to drop away
(i.e.
effect.drop), call an action that manipulates the id paramater a little
bit
(let’s say it will concatenate “This is” to the text) and then puts it
into
the div contents to produce something link this:

This is link1

This is of course not exactly what I am trying to do, but if I can get a
little help with the process I think I can figure the rest out. And
I’ve
got the link dropping away working fine, but I don’t know how to do the
update at the same time.

Any help is appreciated.

Bryan

Hi Bryan,

Bryan T. wrote:

I am trying to do multiple AJAX calls using the link_to_remote
helper or the JavaScript generator update_page. I have googled
and read the docs for both, but can’t seem to figure out exactly
what i need to do.

If you can spare ten bucks, I highly recommend Cody F.s PDF
book(let)
at:

http://www.oreilly.com/catalog/rjsrails/?CMP=ILC-2RQ886833906&ATT=websor

Two or three hours with that and you’ll be amazed at what you’ll be
doing.
Worth several times its price, IMO.

Best regards,
Bill

Hi Bryan,

Bryan T. wrote:

Thanks for the recommendation, the book is great and you’re right,
I was up and running (with some extra knowledge to boot) in no time.

Congrats!

One possibly obvious follow up question (addressed to anyone)
which I also cant find the answer to - I know you can use
:style => “font-size: 2em” or something of that nature to blanketly
format the link_to_remote links, but what about adding hover
effects like you would normally do using something like
a:hover {font-weight: bold}?

My personal preference for things like this is to look first to CSS.
The
starting point I use is http://www.w3schools.com Others will have
differing
opinions :wink:

Best regards,
Bill

Bill,

Thanks for the recommendation, the book is great and you’re right, I was
up
and running (with some extra knowledge to boot) in no time.

One possibly obvious follow up question (addressed to anyone) which I
also
cant find the answer to - I know you can use :style => “font-size: 2em”
or
something of that nature to blanketly format the link_to_remote links,
but
what about adding hover effects like you would normally do using
something
like a:hover {font-weight: bold}?

Bryan

Sorry, I should have explained a little more about what I was doing.
I know how to write the css for this if I was using a seperate
stylesheet, but my link_to_remote command creates a variable number of
links of the format id=“pos#{i}” so I need the css to be inline and
generated along with the links (at least the way I envision it). I
use wc3 schools regularly, love the site, but couldn’t find anything
about this specific issue. If I’m missing something relevant please
point me to it. Thanks for the assistance!

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs