Hey, Matt!  Thanks for the code and explanation!

I'll try it out and see what I can do.

Rick



> -----Original Message-----
> From: Matt Williams [mailto:mgw...@gmail.com]
> Sent: Wednesday, February 04, 2009 7:02 AM
> To: cf-talk
> Subject: Re: This CFC function and jQuery Ajax stuff is killing me...
> 
> 
> Hey Rick,
> 
> What you have coming back is a JSON object. The part of your ajax call
> - success:   function(response) { - is the beginning point for
> displaying that data returned. You'll be adding quite a bit more
> javascript to handle the display. You can either put this additional
> js into that success function or separate it out to a new function. So
> either
> 
> success:   function(response) {
>  --- lots of js code to parse JSON and populate display --
> }
> 
> OR
> 
> success:   function(response) {
>  populatePage(response);
> }
> 
> and then outside that ajax call write:
> function populatePage(response) {
>  --- lots of js code to parse JSON and populate display --
> }
> 
> Doing the display part is where you have to learn to translate your
> abilities to output CF structures and queries to javascript. As James
> said, there is some looping involved. The JSON object is somewhat like
> a CF structure. The variables preceded by a curly bracket are keys in
> that structure. The queries are basically arrays inside the structure.
> 
> I assume you have an empty div or some place in your html to put the
> response data. I'll call it 'myDiv' for now. To display one of the
> simple structure variables, you can do this.
> $('myDiv').append(response.MONTH + '/' + response.YEAR); //variables
> are case sensitive
> 
> For the queries, you can use jQuery's each to loop over the query
> rows. I don't have time to complete this, but here is a start of how
> you can get to that query data.
> function populatePage(response) {
>       $.each(response.QGETSCHEDULE.DATA, function(i, row) {
>               $.each(response.QGETSCHEDULE.COLUMNS, function(j, colName) {
>                       console.log(colName + ': ' + row[j]);
>               });
>       });
> }
> 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:318866
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to