You need to use a server-side include, not a client-side include. How
to do this will depend on which server language you are using.

On Dec 18, 3:24 am, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> I rewrite a new post because the last is damaged.
>
> My problem is that I can't import file js in the new view.
> I must include all javascript code inside the view.
>
> Example:
>
> my.js file:
>
> coolFunc = function() {
>   // contents
>
> }
>
> View Code doesn't work:
>
> <script type="text/javascript" src="/webroot/js/my.js"></script>
>
> .....
>
> View Code  works:
>
> coolFunc = function() {
>   // contents
>
> }
>
> .....
>
> How can I resolve this?
> Many Thanks
> Marco
>
> On 14 Dic, 18:51, "Dan Dorman" <[EMAIL PROTECTED]> wrote:
>
> > On Dec 14, 2007 7:11 AM, [EMAIL PROTECTED]
>
> > <[EMAIL PROTECTED]> wrote:
>
> > > I use the Ajax function  (Ajax.Updater with evalScripts:true) to load
> > > a view in a div.
> > > Now in this view I would load an externaljavascriptfile and use it
> > > inside the view.
> > > But when I use a function defined inside thejavascriptfile I get an
> > > error : "the function is not defined"
>
> > Check the documentation at <http://prototypejs.org/api/ajax/updater>;
> > it describes how to declare functions in external files if you want
> > them to work with Ajax.Updater.
>
> > In a nutshell, though, you want to do this...
>
> > coolFunc = function() {
> >   // contents
>
> > }
>
> > ... instead of this ...
>
> > function coolFunc() {
> >   // contents
>
> > }
>
> > Hope that helps.
>
> > :Dan Dorman
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to