Wondering if it is possible to use 'console.log' code within ColdFusion?
I have deployed the following code but to no effect:
<cfif isDefined("placementCategoryID")>
console.log('Placement Category ID is: ' + placementCategoryID);
<cfif placementCategoryID GT 0>
and
<cfif isDefined("categoryDto")>
console.log('Category DTO is: ' + categoryDto);
as examples but they do not seem to have the desired effect and results do not appear in dev tools window in Chrome.
Apologies if this is a bit of a basic question but any assistance would be appreciated.
Please note, due to customer being difficult, I do not want 'alerts' to pop up... Needs to be within console.log.
Wondering if it is possible to use 'console.log' code within ColdFusion?
I have deployed the following code but to no effect:
<cfif isDefined("placementCategoryID")>
console.log('Placement Category ID is: ' + placementCategoryID);
<cfif placementCategoryID GT 0>
and
<cfif isDefined("categoryDto")>
console.log('Category DTO is: ' + categoryDto);
as examples but they do not seem to have the desired effect and results do not appear in dev tools window in Chrome.
Apologies if this is a bit of a basic question but any assistance would be appreciated.
Please note, due to customer being difficult, I do not want 'alerts' to pop up... Needs to be within console.log.
Share Improve this question edited Oct 14, 2016 at 13:51 ale 6,4307 gold badges59 silver badges65 bronze badges asked Oct 14, 2016 at 12:16 BrettBrett 431 gold badge2 silver badges10 bronze badges 2- 1 Your customer is not being difficult. Unnecessary alerts are annoying and people running your applications should not be subjected to them. – Dan Bracuk Commented Oct 14, 2016 at 13:38
- I agree, I only added that in to prevent any 'Add an alert' ments :) – Brett Commented Oct 14, 2016 at 13:45
3 Answers
Reset to default 5Try wrapping your console.log code with <script>
tags.
Edit: You'll also have to place # around your CF vars.
<cfif isDefined("placementCategoryID")>
<script>
<cfoutput>
console.log('Placement Category ID is #placementCategoryID#');
</cfoutput>
</script>
</cfif>
If you want more robust reporting, check out coldfire.
"ColdFire is an extension to Firebug. It provides debug information in a Firebug tab as opposed to the bottom of the page. This lets you debug and keep your site layout intact, since ColdFusion's built-in debug information can sometimes mess with your site layout."
<cfif isDefined("placementCategoryID")>
<script type="text/javascript">
console.log("Placement Category ID is: "+<cfoutput>#placementCategoryID#</cfoutput>);
</script>
</cfif>