|
Mailing Lists
|
Home / Groups / ColdFusion Talk (CF-Talk)
Return JSON from a CFC> The reason I'm making a web service is b/c I want the JSON to be parsed by > jQuery. Are you telling me client-side Javascript can handle CFCs? jQuery doesn't read WSDL (afaik). Therefore - you don't want a WSDL response. You want a JSON response. You can call any CFC, under web root, with just the url. Try it. Put this CFC under your web root: <cfcomponent> <cffunction name="sayHi" access="remote" returnType="string"> <cfreturn "Ray roxors"> </cffunction> </cfcomponent> If you name this test.cfc, and put it in web root, open your browser to: http://yourhost/test.cfc?method=sayHi You wlll see a response. If you view source, you will see it is XML, in this case, WDDX. To switch to JSON, do: http://yourhost/test.cfc?method=sayHi&returnFormat=json Any CFC under web root, and any method with access=remote, can be directly called by your ajax code. > > > |
February 11, 2012
|
Latest Fusion Authority Articles
|
|||||||||||||||||||||||||||||||||||||||||||||||||