tag:blogger.com,1999:blog-6186498.post6708700065008124133..comments2023-09-18T07:09:45.694-06:00Comments on Things I've Learned: cfajaxproxy, Application.cfm, and painN Mhttp://www.blogger.com/profile/15652512573072388273noreply@blogger.comBlogger14125tag:blogger.com,1999:blog-6186498.post-50994295792453925642010-06-11T09:35:12.361-06:002010-06-11T09:35:12.361-06:00Thank you guys for the fix .It works perfectly fin...Thank you guys for the fix .It works perfectly fine.<br />Awesome fix.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-6186498.post-22386753769749831272008-06-28T02:54:00.000-06:002008-06-28T02:54:00.000-06:00Well, that's actually a quick and dirty solution t...Well, that's actually a quick and dirty solution that Sean Corfield came up with early on to solve the problem. Where that'll give you problems is when you want to access application or session-scoped variables, because the CFCs you're making calls to will have their own application and session scope (if sessions are even enabled). So, as posted earlier, the easiest, best solution I've come across so far is to test for the type of request (if it's a CFC, don't output the header/footer/whatever other shared content, otherwise do).<BR/><BR/>Basically all you do is wrap your header/footer/other shared content in a condition like this:<BR/><BR/>!--- If it's a non-AJAX request, output the shared content ---<BR/>cfif right(cgi.path_info, 4) neq '.cfc'<BR/><BR/>cfinclude <BR/><BR/>/cfifAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-6186498.post-73671585814443145082008-06-28T02:47:00.000-06:002008-06-28T02:47:00.000-06:00Hey, I just spent the last 4 hours trying to figu...Hey, I just spent the last 4 hours trying to figure out what was going on. <BR/><BR/>This thread gave me the idea to just put an empty application.cfc file in the "CFC" directory and just like that... its working again.<BR/><BR/>Wasn't about to stop using my main application.cfc file for building headers and footers.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-6186498.post-56534541990543319482008-06-05T15:39:00.000-06:002008-06-05T15:39:00.000-06:00Nice work. HTML comments still count as output as ...Nice work. HTML comments still count as output as far as breaking AJAX applications is concerned unfortunately.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-6186498.post-5294633343757622522008-06-05T15:29:00.000-06:002008-06-05T15:29:00.000-06:00I figured out the cause for the issue in my case. ...I figured out the cause for the issue in my case. I had 2 dash Comments (ie < !-- ) in my CFC file. <BR/><BR/>When these were removed or changed to 3 dash Comments (ie < !---) I no longer experienced the issue.Unknownhttps://www.blogger.com/profile/02720806288756570351noreply@blogger.comtag:blogger.com,1999:blog-6186498.post-51975465615036089292008-06-05T14:02:00.000-06:002008-06-05T14:02:00.000-06:00I just ran into the problem and it is very frustra...I just ran into the problem and it is very frustrating. I have tried running it with an application.cfm file that has no sort of output and I still get the same issue.<BR/><BR/>What is really frustrating to me is if I load up a backup copy from two days ago it works just fine, though the current version does not. The Javascript that controls it has not changed in that time, only the CFC that is being called and some form elements in the CFM file.<BR/><BR/>If possible, could you please email me the fix you used to resolve the problem at regenshire (at) gmail.<BR/><BR/>Thank you.Unknownhttps://www.blogger.com/profile/02720806288756570351noreply@blogger.comtag:blogger.com,1999:blog-6186498.post-2868982976515985442008-04-09T13:29:00.000-06:002008-04-09T13:29:00.000-06:00That code should work. Post a bigger chunk of the ...That code should work. Post a bigger chunk of the code maybe?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-6186498.post-38979865029900935082008-04-09T12:54:00.000-06:002008-04-09T12:54:00.000-06:00I have tried to usecfif listlast(cgi.path_info,"."...I have tried to use<BR/><BR/>cfif listlast(cgi.path_info,".") is "cfc"<BR/><BR/>to detect whether the request is for a cfc, however, it still not works for me. Any ideas ?Dev Lordhttps://www.blogger.com/profile/02252276288249261531noreply@blogger.comtag:blogger.com,1999:blog-6186498.post-33176717448764923122008-04-08T13:45:00.000-06:002008-04-08T13:45:00.000-06:00Including login.cfm counts as outputting. The .cfm...Including login.cfm counts as outputting. The .cfm file is output to the screen.<BR/><BR/>Look at my post right above yours. All you need to do is test to see if the request is for a .cfc file and if so ignore the cfinclude stuff. Your application will still work as expected.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-6186498.post-87894456618030242042008-04-08T12:04:00.000-06:002008-04-08T12:04:00.000-06:00Oh my god, how to solve it ? I am struggled and to...Oh my god, how to solve it ? I am struggled and tormented by this problem almost a month. In fact, I do not output anything in the Application.cfc but do the following in the onRequestStart() :<BR/><BR/>cfif Not IsUserLoggedIn()<BR/>cfinclude template="login.cfm"<BR/>cfif<BR/><BR/>Why cfinclude would be a problem ? Is that outputing something I don't know ? Any ideas would be appreciated.Dev Lordhttps://www.blogger.com/profile/02252276288249261531noreply@blogger.comtag:blogger.com,1999:blog-6186498.post-79792326623494346762008-04-08T12:02:00.000-06:002008-04-08T12:02:00.000-06:00This comment has been removed by the author.Dev Lordhttps://www.blogger.com/profile/02252276288249261531noreply@blogger.comtag:blogger.com,1999:blog-6186498.post-45569605491456860602008-02-13T17:38:00.000-07:002008-02-13T17:38:00.000-07:00This seems like a quick fix:Test the cgi.path_info...This seems like a quick fix:<BR/>Test the cgi.path_info variable for a '.cfc' extension (or .cfm if you prefer) from within Application.cfc, and only output the shared content if applicable.<BR/><BR/>For example:<BR/><BR/>!--- If it's a non-AJAX request, output the centralized content ---<BR/>openCfif right(cgi.path_info, 4) neq '.cfc' <BR/><BR/> !--- Output the shared resources ---<BR/><BR/>closeCfifAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-6186498.post-7951435931151079272008-02-05T20:24:00.000-07:002008-02-05T20:24:00.000-07:00I would point out that it's considered bad practic...I would point out that it's considered bad practice to unconditionally output html in Application.cfm or Application.cfc.<BR/><BR/>If you think about how AJAX works, it should be obvious that the result of the request to the server must consist of just the valid JSON-encoded data.<BR/><BR/>If you're working with a framework, you need to ensure debug is turned off for AJAX requests.Anonymoushttps://www.blogger.com/profile/15391602120540580436noreply@blogger.comtag:blogger.com,1999:blog-6186498.post-16401959981799323802008-01-22T23:27:00.000-07:002008-01-22T23:27:00.000-07:00I was so freaking frustrated until I read your blo...I was so freaking frustrated until I read your blog (found it through a Google search). SAVED MY LIFE.<BR/><BR/>When I'm sketching up rapid application prototypes sometimes I include some rudimentary styles in the onRequestStart function of Application.cfc, sure as hell, that was breaking it.<BR/><BR/>What kind of fix did you guys come up with? Feel free to email me davidmcguigan AYATT gmail.<BR/><BR/>Thanks so much!!!Anonymousnoreply@blogger.com