Reputation: 147
One of the pages in my application, using Application.cfc, calls a function defined in an Ajax.cfc file using JavaScript (DWREngine) to populate a drop down on page load. When I load that page, I get an error saying "invalid response from server" and the drop down does not populate.
For the function in Ajax.cfc, the access attribute is set to "remote".
I'm not sure why the response is not sent back by the ajax file. Let me know if you need anything else to answer my question.
Update (sorry for being late): I added this piece of code in onRequestStart method in Application.cfc:
<cfif ListLast(CGI.CF_TEMPLATE_PATH, ".") is "cfc">
<cfset StructDelete(this,'onRequest')>
</cfif>
onRequest method causes Ajax failures when called from another CFC in same/sub directories. I also need onRequest and Ajax so found this workaround.
Upvotes: 0
Views: 1223
Reputation: 484
In your workaround, 'this' refers to the component Application.cfc, which is not a structure. What you want is the structure, variables, hence
<cfset StructDelete(variables,'onRequest')>
Upvotes: 1
Reputation: 147
I added this piece of code in onRequestStart method in Application.cfc:
<cfif ListLast(CGI.CF_TEMPLATE_PATH, ".") is "cfc">
<cfset StructDelete(this,'onRequest')>
</cfif>
onRequest method is known to cause Ajax failures when called from another CFC in same/sub directories. I also need onRequest and Ajax so found this workaround.
Upvotes: 0