ok i am not getting it. this is what i have
the cfc that uses JSONUtil to initialize results, but dont htink i am
passing them back?

<!--- get Metric --->
<cffunction name="getMetrics" access="remote">
 <cfargument name="business_unit" type="string" required="yes"><!--- (xxa,
xxv, ET) --->
 <cfset var qry_Metric = arrayNew(1)>
 <cfset var i = 1>
  <cfset var metric = structNew()>
   <!--- getMetrics body --->
    <cfquery name="qry_Metric" datasource="#Application.DSN#">
      SELECT metric_id, metric
      FROM chart_data
        INNER JOIN metric ON metric.id = chart_data.metric_id
      WHERE 1 = 1
    <cfif isDefined("business_unit") AND #business_unit# NEQ "">
      AND business_unit = '#business_unit#'
  </cfif>
      GROUP BY metric_id
      ORDER BY metric_id
    </cfquery>
   <cfset qry_Metric = #JSONUtil.serialize(qry_Metric)#><!--- This is
serilizing in JSON? --->
   <cfdump var="#qry_Metric#" />
   <cfreturn qry_Metric>
    <cfloop index="i" from="1" to="#arguments.business_unit*2#"><!--- Not
sure what this is looping?, not the query result above? --->
     <cfset metric.metric = "..">
     <cfset metric.metric_id = i>
     <cfset arrayAppend(qry_Metric, metric)>
    </cfloop>
<cfreturn qry_Metric>
</cffunction>


-----------------------
the script on the calling page, i dont think i can returnformat json...
maybe i need to call JSONUtil  again?

    //first, detect when initial DD changes
    $("#business_unit").change(function() {
        //get what they selected
        var selected = $("option:selected",this).val();
        //no matter what, clear the other DD
        //Tip taken from:
http://stackoverflow.com/questions/47824/using-core-jquery-how-do-you-remove-all-the-options-of-a-select-box-then-add-on
        $("#metric_id").children().remove().end().append("<option
value=\"\">Select a Metric x</option>");
        //now load in new options if I picked a state
        if(selected == "") return;
    alert(selected); return;

$.getJSON("Training.training_trends_cf.test.cfc?method=getMetrics&returnformat=json",{"business_unit":selected},
function(res,code) {
     alert(getJSON); return; alert(res); return;
            var newoptions = "";
            for(var i=0; i<res.length; i++) {
                //In our result, (metric_id)ID is what we will use for the
value, and (metric)NAME for the label
                newoptions += "<option value=\"" + res[i].metric_id + "\">"
+ res[i].metric + "</option>";
            }
            $("#metric_id").children().end().append(newoptions);
        });
    });
})


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:351785
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to