You can do something like this, have your Jquery call a CFM page that calls
the CFC component.

<script type="text/javascript">
$(document).ready(function() {

 // Call Ajax -
 $.ajax({
  type: "POST",
  url: "act_Call_StatesCities.cfm", //
  dataType: "json",

  beforeSend: function(XMLHttpRequest) {
   // alert("beforeSend");
   $("#loading").show();
   this; // the options for this ajax request
   },

  success: function(responseText){
   alert(responseText);
  },

  error: function(XMLHttpRequest, textStatus, errorThrown) {
     // typically only one of textStatus or errorThrown
     // will have info
     alert("Error - " + textStatus);
     this; // the options for this ajax request
   }
 });

});
</script>

<!--- act_Call_StatesCities.cfm --->
<cfsetting enablecfoutputonly="true">
<cfsetting showdebugoutput="false">
<cfscript>
 odata = createObject("component","CFC/rt_StatesCities");
 thedata = odata.fullJson();
 WriteOutPut(thedata);
</cfscript>

Hope this helps.

Thanks
Mike Hughes                                      [email protected]
--------------------------------------------------------------------------------------------


On Tue, Jan 6, 2009 at 8:51 AM, Cutter (CFRelated) <
[email protected]> wrote:

> Yes, it can. In your Ajax call parameters include returnFormat:'JSON',
> and ColdFusion will automatically serialize your function's return as a
> JSON object.
>
> Steve "Cutter" Blades
> Adobe Certified Professional
> Advanced Macromedia ColdFusion MX 7 Developer
>
> Co-Author of "Learning Ext JS"
> http://www.packtpub.com/learning-ext-js/book
> _____________________________
> http://blog.cutterscrossing.com
>
> Joe wrote:
> > 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?
> >
> >
> >
> >
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:317451
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to