2 Replies Latest reply on Oct 12, 2010 1:49 PM by ilssac

    javascript in coldfusion

    funandlearning333 Level 1

      Hi All -


      I am trying to do the following:


      <script language="text/javascript">
        function abc(arg1, arg2) {
           <cfquery name="q" datasource="..">
              select * from table1 where col1 = arg1




      Is it possible to pass javascript arguments to a coldfusion query which is in turn present in the javascript block?
        • 1. Re: javascript in coldfusion
          Dave Watts Adobe Community Professional

          No, you can't pass JavaScript arguments to CFML within the same page. CFML executes on the server, generating text which is sent to the browser. Once that happens, the browser can execute any JavaScript within the text as appropriate.


          Dave Watts, CTO, Fig Leaf Software




          Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on

          GSA Schedule, and provides the highest caliber vendor-authorized

          instruction at our training centers, online, or onsite.

          • 2. Re: javascript in coldfusion
            ilssac Level 5

            As said in House of Fusion.


            No, not at the same time.


            ColdFusion executes on the server, and JavaScript executes on the client, never will the twain meet.  They execute on completely different computers using completely different memory with completely different variables, running completely different code at completely different times.


            There are plenty of ways to have javascript make requests to a ColdFusion server (i.e. AJAX) and it is trivial to have ColdFusion generate JavaScript to send to the browser.  Just note that they are NOT working together.