3 Replies Latest reply on Jul 19, 2011 11:08 PM by Adam Cameron.

    Interacting with the database without leaving the page

    ACS LLC Level 1

      I have seen on many sites now how it is possible to perform a process and display the results without leaving the page.

       

      Could anybody enlighten me as to how this is possible (without an Iframe?)

       

      Thanks!

       

      Mark

        • 1. Re: Interacting with the database without leaving the page
          Dan Bracuk Level 5

          Don't know what you have against iframes, but ajax is another option.

          • 2. Re: Interacting with the database without leaving the page
            ACS LLC Level 1

            Hi Dan

             

            I've actually used Iframes,  but it seems a little outdated now, and can present issues with having to maintain pages outside of the page, with regards to passing variables back and forwards, users hitting the iframed page direct etc. It looks like a better option to have it all happen in the page.

             

            Is AJAX just one way of many to do this?

             

            Is the code unique for all circumstances, or are there good demo's out there to demonstrate the theory.

             

            Once I get a test set up I could probably start to pick it up from there. I could do with something simple, maybe the ability for somebody to enter a username and have it check the dbase and report back as to whether it is available or not. I have that running ok in IFRAMES right now but would like to try to replace that as my first 'project' to get my hands dirty

             

            Thanks

             

            Mark

            • 3. Re: Interacting with the database without leaving the page
              Adam Cameron. Level 5

              I've actually used Iframes,  but it seems a little outdated now, and can present issues with having to maintain pages outside of the page, with regards to passing variables back and forwards, users hitting the iframed page direct etc. It looks like a better option to have it all happen in the page.

               

              Is AJAX just one way of many to do this?

               

              Agree re iFrames.  It's a clumsy and outdated approach to this sort of thing.

               

              AJAX is pretty much the way of doing behind-the-scenes requests to load new data or mark-up into an existing webpage without doing a full page refresh.  When I say "the way" I don't mean that in the sense of "the best way" or "the currently most popular way", it's just "the one mechanism available to do so".

               

              CF has a fair amount of AJAX leverage built into it:

              http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSc3ff6d0ea77859461172e0811cbec22c24 -7a27.html

               

              However I'd probably forego that lot in favour of doing it with jQuery's AJAX wrapper, which is about as easy to use, and offers a lot more flexibility:

              http://api.jquery.com/category/ajax/

               

              --

              Adam