Skip to main content
October 22, 2016
Question

Coldfusion 9/Ajax/Auto include headers

  • October 22, 2016
  • 3 replies
  • 611 views

Hello,

I have taken over a project and this project is setup that there is always a menu on the top of each html page.  This is fine but I wish to use ajax and if I call a page I want to get raw data passed back to me.  Unfortunately I get the template that has been setup ad the results buried inside.  How do I specify a call not to include all the default header information.  Is there some type of tag to state raw text is coming out, or anything similar.

Thank you,

Dave

    This topic has been closed for replies.

    3 replies

    Inspiring
    October 31, 2016

    What endpoint are you calling?  It sounds like it is not restful. Are you calling a CFM page with a header/footer included?  Does the project use a framework that could be including a template?  Are you calling a CFC directly, and if so what returntype and returnformat is being set on the called method?  Without some other information this won't be something we can easily troubleshoot.

    Dave Ferguson
    Participating Frequently
    October 24, 2016

    Ideally, your ajax calls should go to to a different location that don't render UI elements.  Adding a bunch of IF conditions around the code just just sloppy and hard to read. 

    WolfShade
    Legend
    October 24, 2016

    It depends upon how the site has been coded.

    Some sites use CFINCLUDE in each page to place a navigation or menu on the page.

    Some sites place the nav/menu code (or a CFINCLUDE to it) in the onRequest page, so it loads on every page.

    Some developers will use JavaScript or jQuery to dynamically load the nav/menu.

    In a nutshell, without knowing anything about your site, we can't answer your question.    How is your inherited project laid out?

    V/r,

    ^_^

    October 27, 2016

    Tans for the reply,

    The problem is there is no place where it specifically as for another page like a header.  i am making the assumption that it is setup within the ColdFusion configuration itself.  Is there flag to include this unnecessary information with my ajax call?  st raw output in whatever I deem fit.  I don't want to have to turn it off in the ColdFusion configuration then see if anything is broken.  Any hack would work.

    Regards,

    David Carachelo

    WolfShade
    Legend
    October 27, 2016

    I am not completely versed with CFAdmin, but I am not aware of any setting in CFAdmin that could be set to automatically include headers, footers, etc.

    So there _must_ be code, somewhere, that includes the extra stuff.  If you're not finding it in CF code, look through ALL the JavaScript and jQuery (if applicable) code to see if there is anything in there that loads the header.

    HTH,

    ^_^