Ok... something to talk about besides $20/hr (which may look
really good, depending on how hungry you are...)

I recently started using cfhtmlhead in onApplicationStart to put
the following CF/JS in the head of each page to translate my CF
site variables to JS:

<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>

        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>

However, I just coded a page to load its content via jQuery AJAX
which accesses a CFC method which uses cfSaveContent to generate
the page.s HTML and then saves that to a document, which is then loaded
via jQuery AJAX.

After cfSaveContent does its thing, I send a 'Success' message
in JSON back to the AJAX call.  But this wasn't working.  I've written
this routine hundreds of times, so I know nothing was wrong with the
AJAX code.

It turns out that the JS above in between the two <cfoutput>'s was
being sent back in the JSON, which was causing the message being sent
back to the AJAX call to not just be 'Success', which would trigger
the page HTML loading.

Why would the above JS show up in the JSON data and what can I do about
it?  Taking the cfhtmlhead functionality out of the application.cfc's
onApplicationStart routine and putting it manually in the head of the
document solved the problem, but I enjoyed being able to insert the
variable routine into the head of each page automatically.

Thoughts?  Suggestions?

For $20 an hour? :o)

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:347680
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to