Skip to main content
May 16, 2008
Question

cfc / ajax / must be in root directory

  • May 16, 2008
  • 5 replies
  • 1193 views
I am just starting to work with the CF 8 ajax. I am finding many in posts/examples that to get the cfc to work, it must be in the root directory. I am not finding specific information on what is causing this other than a conflict with the application.cfm / application.cfc file.
What is allowed and what is not allowed to go into an application file to allow .cfc to work in the same directory as the file calling it?

It is very inconvenient to have to place all the cfc files at the root and not in the same directory as the file calling it.

the last example i was working with comes from:
http://www.brucephillips.name/blog/index.cfm/2007/8/8/Updating-and-Adding-Records-Being-Displayed-In-ColdFusion-8s-cfgrid

which describes the .cfm and .cfc file to be in the same directory. (which doesnt work) -- but in the comments - there is the example of locating the .cfc file in the root directory and adding a slash (/) in front of the path. and this works for me.
I had the same problem yesterday trying to get the Ben Forta art.cfc autosuggest example working.
    This topic has been closed for replies.

    5 replies

    Inspiring
    May 19, 2008
    sorry, i do not use eclipse enough for cf development to help you with
    that... :)

    Azadi Saryev
    Sabai-dee.com
    http://www.sabai-dee.com/
    May 19, 2008
    they are cf comments...
    but there are several blank lines between commented sections.
    i appreciate all the information with this, it explains the behavior that i was getting.
    want to take a shot at why my debugging will not work? ;-)
    http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?catid=3&threadid=1315339
    Inspiring
    May 19, 2008
    the code in application.cfm gets processed before each and every
    request, and any output of application.cfm gets attached to each and
    every request. does not matted if a request is for a .cfm or a .cfc
    page. and since cf functions using ajax calls usually expect properly
    formed json data in return, any output added by application.cfm file
    will break the data format.

    are the coments in your application.cfm file proper cf comments or html
    comments? any blank lines in it?

    Azadi Saryev
    Sabai-dee.com
    http://www.sabai-dee.com/
    May 19, 2008
    i have narrowed down the problem to any directory that was below a blank application.cfm file - why would that cause an issue?
    wwwroot = worked fine
    wwwroot/testcfc = worked fine
    wwwroot/myapp = did not work - but this had a blank application.cfm file in it - containing ONLY a small amount of commented out code.
    Inspiring
    May 17, 2008
    iirc, the main requirement for using cfc's and cf ajax features is that
    cfc's muct be under web root, i.e. web-accessible. you can't use cfc's
    in a mapped location. but they do not have to be IN the web root - they
    can just as well be in [webroot]/folder/folder/folder/.../folder/cfc

    Azadi Saryev
    Sabai-dee.com
    http://www.sabai-dee.com/
    May 19, 2008
    i guess that is the question i am trying to ask. that the cfc doesnt work UNLESS it is at the exact webroot.

    if i place the cfc in the same directory as the .cfm page -- the cfc does not work.
    if i take the cfc and drop it to the root of the webroot - it does work.
    i am on IIS.

    i am copying and pasting examples exactly as people are using them and none work.
    if i move the cfc and adjust the pathname -- it works all the time.