| | 1 | The [http://docs.model-glue.com/wiki/HowTos/HowToUseRemoting RemoteService] is a mechanism to use the logic and work flows configured in your Model-Glue application for uses beyond the typical HTML application. For example, you can access your Model-Glue application to get data for an Ajax or a Flex client as well. |
| | 2 | |
| | 3 | If you are doing Ajax work, and just doing div replacement style coding, you do not need the RemoteService, only if you want to return raw data does it become important. |
| | 4 | |
| | 5 | There is a [http://docs.model-glue.com/wiki/HowTos/HowToUseRemoting full article series describing the RemotingService] already, below is the readers digest version illustrating the main ideas: |
| | 6 | |
| | 7 | 1 Put a RemoteService.cfc object at the root of your Model-Glue application that extends ModelGlue.gesture.remoting.AbstractRemotingService |
| | 8 | 2 Edit the RemoteService.cfc and ensure the template value is set correctly |
| | 9 | |
| | 10 | {{{ |
| | 11 | <cfset template = "/mgtest/index.cfm" /> |
| | 12 | }}} |
| | 13 | |
| | 14 | 3 Call the RemoteService from your Ajax or Flex client |
| | 15 | |
| | 16 | ===Ajax Example=== |
| | 17 | {{{ |
| | 18 | $.get("http://www.someapp.com/RemoteService.cfc", { name: "John", time: "2pm" } ); |
| | 19 | }}} |
| | 20 | |
| | 21 | ===Flex Example=== |
| | 22 | |
| | 23 | {{{ |
| | 24 | <mx:RemoteObject id="mgrs" |
| | 25 | destination="ColdFusion" |
| | 26 | source="http://www.someapp.com/RemoteService.cfc" |
| | 27 | result="resultHandler(event)" |
| | 28 | showBusyCursor="true" /> |
| | 29 | }}} |
| | 30 | |
| | 31 | |
| | 32 | Now you can work with your data as you please in either type of client, Flex or HTML/Javascript. |
| | 33 | |