If the only issue troubling you is the script based CFC, just rewrite it:
component {
remote function getCities(required numeric stateid) {
var result = [];
//This would be a db call
for(var i=1; i<arguments.stateid*2; i++) {
var city = {};
city.name = "Some City #i# for State #arguments.stateid#";
city.id = i;
arrayAppend(result, city);
}
return result;
}
}
That is:
<cfcomponent>
<cffunction name="getCities" access="remote">
<cfargument name="stateid" type="numeric" required="true">
<cfset var result = arrayNew(1)>
<cfset var i = 1>
<cfloop index="i" from="1" to="#arguments.stateid*2#">
<cfset var city = structNew()>
<cfset city.name = "..">
<cfset city.id = i>
<cfset arrayAppend(result, city)>
</cfloop>
<cfreturn result>
</cffunction>
</cfcomponent>
I typed that in and didn't actually run it, so look out for typos, and
I didn't bother retying the "name" aspect.
Although I don't remember if returnformat=json was added in CF8 or 7.
If it was 8, then you need to write a CFM that uses a JSON CFC (check
RIAForge, there should be a bunch) to generate a JSON result from the
data.
On Sat, Jun 30, 2012 at 10:22 AM, morchella
<[email protected]> wrote:
>
> Hey Guys.
> I need to be able to have 2,3 or 5 selects related.
> CF server 7, latest jquery lib.
>
> I have looked at the relevant examples i could find. but not sure how to
> make them work with standard cfc functions/query's
> http://www.raymondcamden.com/index.cfm/2011/5/5/Related-selects-in-jQuery--an-example
> (i just dont understand the syntax of the cfc that looks like script,
> instead of <cffunction>)
> any how, if any of you folks have seen any other good tutorials i would
> appreciate it,
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:351773
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm