Hello
I have the following json call:
<script>
$.ajax({
url:"data.cfc?method=getData"
,dataType:"json"
,success: function( cfdata ){
data = $.standardiseCfQueryJSON( cfdata );
// do something with the data
return data;
}
});
</script>
Here is my cfc
<cffunction name="getData" access="remote" returntype="any" returnformat="json">
<cfquery name="qryLoc" datasource="cfartgallery">
select * from artists
</cfquery>
<cfoutput>
<cfset i = 1>
<cfset data = ArrayNew(1)>
<cfloop query="qryLoc">
<cfset row = StructNew()>
<cfset row["artistID"] = "#qryLoc.artistID#">
<cfset row["firstName"] = "#qryLoc.firstName#">
<cfset row["locfstname"] = "#qryLoc.lastname#">
<cfset data[i] = row>
<cfset i = i + 1>
</cfloop>
<cfreturn #serializeJSON(data)#>
</cfoutput>
</cffunction>
How do I access and then output the data returned?
Thanks
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:360217
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm