# Help with link\_to\_remote or javascript generator

**URL:** <https://www.ruby-forum.com/t/help-with-link-to-remote-or-javascript-generator/98433>\
**Category:** Rails\
**Created:** [July 14, 2006, 6:56pm UTC](https://www.ruby-forum.com/t/help-with-link-to-remote-or-javascript-generator/98433 "2006-07-14T18:56:54Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![bryan\_t](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/7bcc69/32.png) [@bryan\_t](https://www.ruby-forum.com/u/bryan_t)\
**Post date:** [July 14, 2006, 6:56pm UTC](https://www.ruby-forum.com/t/help-with-link-to-remote-or-javascript-generator/98433/1 "2006-07-14T18:56:54Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![bryan\_t](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/7bcc69/32.png) [@bryan\_t](https://www.ruby-forum.com/u/bryan_t)\
**Post date:** [July 14, 2006, 7:14pm UTC](https://www.ruby-forum.com/t/help-with-link-to-remote-or-javascript-generator/98433/2 "2006-07-14T19:14:35Z")

</div>

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:

> **[RJS Templates for Rails](https://www.oreilly.com/library/view/rjs-templates-for/0596528094/?CMP=ILC-2RQ886833906&ATT=websor)**
>
> RJS templates are an exciting and powerful new type of template added to Rails 1.1. Unlike conventional Rails templates that generate HTML or XML, RJS templates generate JavaScript code that … - Selection from RJS Templates for Rails \[Book\]

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

---

<div class="post-metadata">

**Author:** ![bryan\_t](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/7bcc69/32.png) [@bryan\_t](https://www.ruby-forum.com/u/bryan_t)\
**Post date:** [July 15, 2006, 7:07pm UTC](https://www.ruby-forum.com/t/help-with-link-to-remote-or-javascript-generator/98433/3 "2006-07-15T19:07:53Z")

</div>

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](http://www.w3schools.com) Others will have  
differing  
opinions 😉

Best regards,  
Bill

---

<div class="post-metadata">

**Author:** ![bryan\_t](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/7bcc69/32.png) [@bryan\_t](https://www.ruby-forum.com/u/bryan_t)\
**Post date:** [July 15, 2006, 6:45pm UTC](https://www.ruby-forum.com/t/help-with-link-to-remote-or-javascript-generator/98433/4 "2006-07-15T18:45:21Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![bryan\_t](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/7bcc69/32.png) [@bryan\_t](https://www.ruby-forum.com/u/bryan_t)\
**Post date:** [July 15, 2006, 7:33pm UTC](https://www.ruby-forum.com/t/help-with-link-to-remote-or-javascript-generator/98433/5 "2006-07-15T19:33:37Z")

</div>

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!
