3 Replies Latest reply on Apr 20, 2009 2:04 PM by marty_moran

    setting the results of a query to a variable

    marty_moran

      Hi all,

           I'm having a problem setting the results of a query to a variable. What I'm trying to do is make an AJAX call to a .cfc file and pass back the results of the function. The main problem is, I'm trying to pass back a block of HTML code ( resulting from a cfquery to a cfoutput ) stored in a variable. My code is something like..

       

      <cffunction name="getText" access="remote" returntype="void">

       

              <cfquery datasource="#request.dsn#" name="queryTable">
                  SELECT  infoA, infoB

                  FROM  infoTable

              </cfquery>

             
              <cfset result = '<!--- this is the part I'm stuck on, I want the table to go here. --->'>

       

                    <table>
                        <cfoutput query="tablequery">
                        <tr>
                        <td>#infoA#</td><td>#infoB#</td>
                        </tr>
                        </cfoutput>
                    </table>


          <cfwddx action="cfml2js" input="#result#" toplevelvariable="r">

       

      </cffunction>

       

      This is a simplified version of what I want to do, but you get the idea..

       

      Is this even the right way of going about it??  Thanks