brianmfalls
asked on
Coldfusion, jQuery, Ajax and adding cfsetting showdebugoutput="false" to the returned content.
I was looking at Ray Camden's blog, and I found a cool little tidbit (he has sooo many).
Blocking ColdFusion Debugging for AJAX Requests
Can I do something similar with the attached code? If so, how do I do it? (by 'it', I mean, how do I apply <cfsetting showdebugoutput="false"> to the template loaded into the content area)
T.I.A. All!
Blocking ColdFusion Debugging for AJAX Requests
Can I do something similar with the attached code? If so, how do I do it? (by 'it', I mean, how do I apply <cfsetting showdebugoutput="false"> to the template loaded into the content area)
T.I.A. All!
The onClick event:
onclick="loadTemplate('<cfoutput>#request.thisModule#/templates/#request.thisTemplate#</cfoutput>','ajaxContainer',<cfoutput>#getEmailTemplates.layoutID#</cfoutput>), processTemplateChange('<cfoutput>#getEmailTemplates.layoutID#</cfoutput>');"
loadTemplate function:
function loadTemplate(templatePath,containerID,templateID) {
$('#'+containerID).load(templatePath, function() {
var cookies = document.cookie.split(";");
for (var i = 0; i < cookies.length; i++) {
var cookie = cookies[i];
var eqPos = cookie.indexOf("=");
var name = eqPos> -1 ? cookie.substr(0, eqPos) : cookie;
document.cookie = name + '=;expires=Thu, 01 Jan 1970 00:00:00 GMT';
}
});
$('#vignetteLibraries').load('<cfoutput>#request.url#</cfoutput>admin/emailBeta/uiElements/cfm/element.vignette.libraries.cfm',{'templateID': templateID}, function() {
});
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Almost. You also need to add the snippet above to your onRequestStart method too. But yeah, it should be that simple.
ASKER
Oh man. I wasn't thinking about the applicaiton.cfc at all... lol Thanks aqx.
Two more quick questions on the snippet you posted.
Is the following argument passed by coldfusion by default, or do I need to specify it in each request?
<cfargument name="thePage" type="string" required="true">
What is the following var doing?
<cfset var reqData = "">
Two more quick questions on the snippet you posted.
Is the following argument passed by coldfusion by default, or do I need to specify it in each request?
<cfargument name="thePage" type="string" required="true">
What is the following var doing?
<cfset var reqData = "">
ASKER
Now that I think about it, neither are required. I can see now that you just copied that off of Ray's site. Thanks again aqx. As always, your input is spot on.
It's passed by default. So you don't have to do anything extra.
<cfset var reqData = "">
Actually you can get rid of that. It *was* used in Ray's example to hold the getHttpRequestData(). But it's not needed in the new example.
<cfset var reqData = "">
Actually you can get rid of that. It *was* used in Ray's example to hold the getHttpRequestData(). But it's not needed in the new example.
Now that I think about it, neither are required.
Actually the argument is required. The OnRequestStart function *must* have a specific signature or it may not work at all. So don't change anything about the cffunction name or it's arguments.
Actually the argument is required. The OnRequestStart function *must* have a specific signature or it may not work at all. So don't change anything about the cffunction name or it's arguments.
<cffunction name="onRequestStart" returnType="boolean" output="false">
<cfargument name="thePage" type="string" required="true">
<cfif structKeyExists(url, "enableDebugOutput")>
<cfsetting showdebugoutput="false">
</cfif>
<cfreturn true>
</cffunction>
ASKER
True. I was just getting to pull my foot out of my mouth when you were kind enough to do it for me. :)
You're welcome. I remember learning that the frustrating way: never change the signature of Application.cfc methods ;-)
ASKER
Like so?
onclick="loadTemplate('<cf
I can't do it exactly as he did, since I am none of what I posted is in a cfc. The onclick is in an image tag, within a carousel that displays available templates. The script is an included element in a custom framework.