I have this code as a cffunction that works fine:
<cfcomponent extends="core.core">
<cffunction name="loadService" access="remote" returnformat="JSON">
<cfscript>
objResponse = '{"CONFIG":[["internal"],[ "success"]],"DATA":[["Message1"]]}';
</cfscript>
<cfreturn objResponse>
</cffunction>
</cfcomponent>
I am trying to convert it to a full cfscript function like this:
component extends="core.core"{
remote JSON function loadService(){
objResponse = '{"CONFIG":[["internal"],[ "success"]],"DATA":[["Message1"]]}';
SerializeJSON(objResponse);
return objResponse;
}
}
The first way returns JSON fine and I can process it with jQuery. The second one throws and error "The value returned from the loadService function is not of type JSON."
I have tried it with and without SerializeJSON and both ways throw that error. I have also tried it without specifying JSON in the function syntax. That does not throw an error but it does wrap wddxpacket info around it. This is what it looks like when I don't specify JSON:
<wddxPacket version='1.0'><header/><data><string>{"CONFIG":[["internal"],[ "success"]],"DATA":[["Message1"]]}</string></data></wddxPacket>
I am stuck on this. Any help would be great. Thanks!