CFAjaxProxy Problems or RTFM
So recently I’d been doing a cfselect box using bind to create my desired linked drop down. The problem I was having was that I wanted to do a zebra stripe on the select after it had been loaded. I could not find a way to attach the bind event to anything else so I couldn’t call a function after the bind had actually completed. The way I wanted to solve this was to use a setTimeout on the coloring process. The problem I was having was that my serializedJSON output I was using was no longer working. It turns out – if you read the documentation – that using cfajaxproxy to pull in a CFC automatically serializes your output. So if you’re returning a result of String with a serializeJSON(myQuery) you will end up with the data being DOUBLE SERIALIZED! Oh what a headache that was. The proper way to do this:
1 2 3 4 5 6 7 8 9 | <cfajaxproxy cfc="myData" jsclassname="myDataClass" />
<script>
getData = function(){
var o = new myDataClass();
var dataset = o.getData($('toggleField').checked);
return dataset;
}
</script> |
Is to have your CFC do this
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | <cfcomponent> <cffunction name="getData" access="remote" returntype="query"> <cfargument name="myToggle" type="string" required="yes" default="false" /> <cfset var qryData = 0 /> <cfquery name="qryData " datasource="DATAS"> SELECT * FROM tableData </cfquery> <cfreturn qryData> </cffunction> </cfcomponent> |
Rather than serializing it yourself first. If you’re binding with a method of cfc: then you don’t need to do this, instead you need to change it to return text and use the SerializeJSON on your qryData query.

