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]);
                });
        });
}

On Wed, Feb 4, 2009 at 12:57 AM, James Holmes <james.hol...@gmail.com> wrote:
>
> Try $.getJSON instead of $.ajax for a little more efficiency.
>
> cfajaxproxy is the JS way of getting to the same point, essentially.
> With either method, you need to be able to write the JS you need to
> use the result set. You're getting back an object with two properties:
> COLUMNS and DATA. COLUMNS is an array; DATA is an array of arrays. So
> yes, there's going to be some looping involved.

-- 
Matt Williams
"It's the question that drives us."

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:318860
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