How to call javascript function in A site?

Hello, rubiers.
now, I wanna call some functions in A site that was already
implemented by another company. ( I don’t know internal… just
anyway, there are several javascript functions in there what I want
call frequently in my ruby scripts.
HOW DO I connect it and call it?
Could you give me some examples?

for example)

hello, this is template!! click func_a().... that is my goal to call in my scripts. thanks you.

Jun Y. wrote:

hello, this is template!! click

This is a very old technique and I would not recommend using this style
to call JavaScript functions.

Here is a more modern syntax:

The most recent trend that is emerging is called “Unobtrusive
JavaScript.” This new technique separates page behavior from page
structure and presentation. Notice the “return false;” at the end of the
onclick attribute.

func_a().... that is my goal to call in my scripts. thanks you.

I would recommend putting your JavaScript functions in an external file
inside “public/javascripts” and include them from inside :

<%= javascript_include_tag 'application' %>

Or, if you want to also include the Prototype JavaScript libraries:

<%= javascript_include_tag :defaults %>

Doing this will also include public/application.js along with the
Prototype library.

actually, this is not what i want to do :wink:
sorry my poor english sentences made you misunderstand it.


if there is a general website like amazon, the site has plenty of
javascript function.

the one of them is func_a() function what I want to call it.

in my local,
there is a ruby script to check some situation that does satisfy any
by using this ruby script, I want to call func_a() in a server-side.

is this possible?
I think this is really easy functionality. but I could not find any
solutions for me.

thanks for your concerns.

following code might help you

<% if rails_condition%>