JS is client side. CF is server side. You can use CF to generate the js code
that the browser will run, but you can't actually run it on the server side.
(Caveat is server-side js ofcourse.)


On Thu, Sep 15, 2011 at 11:36 AM, Rick Faircloth
<r...@whitestonemedia.com>wrote:

>
> Hi, Michael...
>
> No, I'm not trying to output anything to the browser, just
> establish the variables, in this case the JS global variables
> for use throughout the site.
>
> I establish all the CF variables in the application.cfc and
> was trying to see if I could accomplish the same thing with the
> JS variables.  But trying to process any JS within a .cfc
> always just returns the JS script, itself.
>
> It seems like JS can't be processed in a .cfc, or perhaps I'm
> missing something.
>
> I've been cfincluding a file that processes the JS variables,
> such as those below, as part of the .cfm pages, but was just
> trying to see if I could do it once in the application.cfc
> in the onRequest section.
>
> Rick
>
> -----Original Message-----
> From: Michael Grant [mailto:mgr...@modus.bz]
> Sent: Thursday, September 15, 2011 11:27 AM
> To: cf-talk
> Subject: Re: Any way to process this within onRequest in Application.cfc?
>
>
> What exactly do you mean by processed? Do you mean outputted to the
> browser?
> Wouldn't the code you show end up being before the doctype declaration of
> an
> html page?
>
>
>
> On Thu, Sep 15, 2011 at 11:21 AM, Rick Faircloth
> <r...@whitestonemedia.com>wrote:
>
> >
> > <!--- [ js version of cf variables ] --->
> >
> >     <cfset   js_sitename          =  application.sitename          />
> >     <cfset   js_website           =  application.website           />
> >     <cfset   js_site_manager_dsn  =  application.site_manager_dsn  />
> >     <cfset   js_client_dsn        =  application.client_dsn        />
> >
> >     <cfoutput>
> >
> >          <script type="text/javascript">
> >
> >               var  js_sitename          =  '#js_sitename#';
> >               var  js_website           =  '#js_website#';
> >               var  js_site_manager_dsn  =  '#js_site_manager_dsn#';
> >               var  js_client_dsn        =  '#js_client_dsn#';
> >
> >          </script>
> >
> >     </cfoutput>
> >
> >
> > It seems that no matter how I try to do it, either putting js directly
> > into an application.cfc or either using a cfinclude in an
> > onRequest function, the js can't be processed along with the other
> > code in the application.cfc.
> >
> > I'm trying to locate all variables for a site in one place (part of
> > an MSOC design.
> >
> > Rick
> >
> >
> >
> >
>
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:347490
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to