Re: This CFC function and jQuery Ajax stuff is killing me...

2009-02-05 Thread Paul Stewart

Sorry does not mean a lot to me either. )-:

I would be going through that line by line using an alert box to output 
variables till i could isolate the problem. Other than that i'd say get 
a hold of learning Jquery. Its not that big a read. It does sound as if 
you need more grounding in jquery.

Rick Faircloth wrote:
> I tried modifying my jQuery for the pattern you have below, but
> I'm getting an error.  I'm sure it's because my query is more
> involved and I'm not implementing your suggestion correctly.
>
> The error I'm getting is:
>
> s.url.match is not a function
> onreadystatechange()()
> onreadystatechange()()
> onreadystatechange()()
> getSchedule()
> onmouseup(mouseup clientX=616, clientY=288)
> jQuery.readyList.push(function() {returnurl, 
> s.async,s.username,s.password);else
>
> I have no clue what that is trying to tell me...
>
> The entire query now looks like this:
>
> 
>   
>function getSchedule() {
>   
>   if  ($('option:selected', '#year').val() == ''
>   ||   $('option:selected', '#month').val() == '00')
>
>   { $('#error-month-year').fadeIn(500); }
>   
>   else
>
>   { 
>  if ( $('#error-month-year').attr('visible', 'visible') )
>  
> { $('#error-month-year').fadeOut(250); }
>
>  var formval = { dsn:  
> '<cfoutput>#application.dsn#</cfoutput>',
>  month:$('option:selected', '#month').val(),
>  day:  $('#day').val(),
>  year: $('option:selected', '#year').val() };
>   
>  console.log(formval);
>
>  $.getJSON ({   cache: false,
>  url:   
> "../components/floor_duty.cfc?method=get_duty_schedule",
>  data:  formval,
>  success:   function(data) {
>
>$.each(data, function(structKey, 
> structValue) {
>   
>
>   var buildDate = 
> structValue['month'] +
> structValue['year'] ;
>   
>
>});
>   
>
> }
>  });
>   }
>};
>
> 
>
>
>
>
>
>   
>> -Original Message-
>> From: Paul Stewart [mailto:p...@whichfranchise.com]
>> Sent: Wednesday, February 04, 2009 10:54 AM
>> To: cf-talk
>> Subject: Re: This CFC function and jQuery Ajax stuff is killing me...
>>
>>
>> Just been reading Learning Jquery so hopefully this can get you on the
>> right track
>>
>> $(document.ready(function( ) {
>>
>> $.getJSON('cfcName.cfc?method=methodName',function(data)
>> {
>> $.each(data,function(structKey, structValue){var buildDate =
>> structValue['month'] + structValue['year'] ; });
>> });
>>
>> });
>>
>> The 1st callback function (in $getJSON method) uses your cfcs returned
>> JSON (i.e. data).
>>
>> The 2nd callback function belonging to the $.each method has access to
>> the current iteration key/value pair of your json(struct).
>>
>> Have not tried it but if cfc access set to remote and returnformat =
>> json i think it should bear fruit
>>
>> Rick Faircloth wrote:
>> 
>>> Not to overly dramatic, but, I think my head really is
>>> about to explode.  I know my blood pressure is sky high!
>>> I'm going to conquer this stuff or die trying! (Probably
>>> will kill me...)
>>>
>>> Anyway, I'm trying to return data from a method involving
>>> 2 queries of data and some random data via ajax.
>>>
>>> I'm in *over* my head... I can work with simple stuff, but
>>> these functions are getting complex.
>>>
>>> Here's what I'm setting up to return via :
>>>
>>> 
>>> 
>>> 
>>> 
>>> 
>>>
>>> 
>>>
>>> I have no idea if that's how I should be trying to return all that data.
>>>

Re: This CFC function and jQuery Ajax stuff is killing me...

2009-02-04 Thread John M Bliss

Fair enough.  There *are* limits to what cfgrid can do "natively."  But the
basics are *so* easy.

On Wed, Feb 4, 2009 at 2:46 PM, Rick Faircloth wrote:

>
> Well, I have to admit I've never tried any of the
> CF8 built-in ajax widgets.
>
> I've considered it, but as with most widgets, sooner
> or later I'm going to run into their limitations and
> have to learn to get more granular control over the
> code by hand-coding it so I might as well start now.
>
> I've been working with jQuery and, up until now, everything
> I've tried has been relatively simple.
>
> So, I thought I'd just try to tackle this so I can
> keep everything hand-coded.  (A glutton for punishment...)
>
> Rick
>
> > -Original Message-
> > From: John M Bliss [mailto:bliss.j...@gmail.com]
> > Sent: Wednesday, February 04, 2009 3:20 PM
> > To: cf-talk
> > Subject: Re: This CFC function and jQuery Ajax stuff is killing me...
> >
> >
> > Maybe OT but do you dislike cfgrid?
> >
> > On Wed, Feb 4, 2009 at 12:57 PM, Rick Faircloth <
> r...@whitestonemedia.com>wrote:
> >
> > >
> > > Hi, John...and thanks for the reply.
> > >
> > > Yes, the data is headed for a table.
> > >
> > > I'll be outputting rows set up like this:
> > >
> > > Date am/pm position agent
> > >
> > > Just those four rows.  This is the first
> > > time I've tried to output more than single
> > > elements returned via ajax.  Usually, I can just
> > > specify what the individual data is for the return,
> > > such as struct.name, struct.date, etc.  Now I'm trying
> > > to figure out how to deal with queries, etc.
> > >
> > > I wish I could somehow get this back into a structure
> > > where I could use CF code to deal with it...oh, that
> > > would be nice...
> > >
> > > Rick
> > >
> > >
> > > > -Original Message-
> > > > From: John M Bliss [mailto:bliss.j...@gmail.com]
> > > > Sent: Wednesday, February 04, 2009 7:37 AM
> > > > To: cf-talk
> > > > Subject: Re: This CFC function and jQuery Ajax stuff is killing me...
> > > >
> > > >
> > > > Can we have some more background?  What are you going to be doing
> with
> > > this
> > > > data once you get it back to the calling page?  A grid or what?
> > > >
> > > > On Tue, Feb 3, 2009 at 11:57 PM, 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.
> > > > >
> > > > > mxAjax / CFAjax docs and other useful articles:
> > > > > http://www.bifrost.com.au/blog/
> > > > >
> > > > >
> > > > >
> > > > > 2009/2/4 Rick Faircloth :
> > > > > >
> > > > > > The call that I've been using is
> > > > > >
> > > > > > $.ajax({  cache: false,
> > > > > >  type:  "post",
> > > > > >  url:
> > > > > "../components/floor_duty.cfc?method="get_duty_schedule",
> > > > > >  dataType:  "json",
> > > > > >  data:  "formval",<--- form values, etc., are put
> > > into
> > > > > this variable
> > > > > >  success:   function(response) {
> > > > > >
> > > > > > etc...
> > > > > >
> > > > > > and in the cfc method, I specify returnFormat = "json".
> > > > > >
> > > > > > I looked over the Adobe docs and another resource I found,
> > > > > > but I've got to tell you, I couldn't figure out what to do
> > > > > > with the information.
> > > > > >
> > > > > > 

RE: This CFC function and jQuery Ajax stuff is killing me...

2009-02-04 Thread Rick Faircloth

Well, I have to admit I've never tried any of the
CF8 built-in ajax widgets.

I've considered it, but as with most widgets, sooner
or later I'm going to run into their limitations and
have to learn to get more granular control over the
code by hand-coding it so I might as well start now.

I've been working with jQuery and, up until now, everything
I've tried has been relatively simple.

So, I thought I'd just try to tackle this so I can
keep everything hand-coded.  (A glutton for punishment...)

Rick

> -Original Message-
> From: John M Bliss [mailto:bliss.j...@gmail.com]
> Sent: Wednesday, February 04, 2009 3:20 PM
> To: cf-talk
> Subject: Re: This CFC function and jQuery Ajax stuff is killing me...
> 
> 
> Maybe OT but do you dislike cfgrid?
> 
> On Wed, Feb 4, 2009 at 12:57 PM, Rick Faircloth 
> wrote:
> 
> >
> > Hi, John...and thanks for the reply.
> >
> > Yes, the data is headed for a table.
> >
> > I'll be outputting rows set up like this:
> >
> > Date am/pm position agent
> >
> > Just those four rows.  This is the first
> > time I've tried to output more than single
> > elements returned via ajax.  Usually, I can just
> > specify what the individual data is for the return,
> > such as struct.name, struct.date, etc.  Now I'm trying
> > to figure out how to deal with queries, etc.
> >
> > I wish I could somehow get this back into a structure
> > where I could use CF code to deal with it...oh, that
> > would be nice...
> >
> > Rick
> >
> >
> > > -Original Message-
> > > From: John M Bliss [mailto:bliss.j...@gmail.com]
> > > Sent: Wednesday, February 04, 2009 7:37 AM
> > > To: cf-talk
> > > Subject: Re: This CFC function and jQuery Ajax stuff is killing me...
> > >
> > >
> > > Can we have some more background?  What are you going to be doing with
> > this
> > > data once you get it back to the calling page?  A grid or what?
> > >
> > > On Tue, Feb 3, 2009 at 11:57 PM, James Holmes  > >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.
> > > >
> > > > mxAjax / CFAjax docs and other useful articles:
> > > > http://www.bifrost.com.au/blog/
> > > >
> > > >
> > > >
> > > > 2009/2/4 Rick Faircloth :
> > > > >
> > > > > The call that I've been using is
> > > > >
> > > > > $.ajax({  cache: false,
> > > > >  type:  "post",
> > > > >  url:
> > > > "../components/floor_duty.cfc?method="get_duty_schedule",
> > > > >  dataType:  "json",
> > > > >  data:  "formval",<--- form values, etc., are put
> > into
> > > > this variable
> > > > >  success:   function(response) {
> > > > >
> > > > > etc...
> > > > >
> > > > > and in the cfc method, I specify returnFormat = "json".
> > > > >
> > > > > I looked over the Adobe docs and another resource I found,
> > > > > but I've got to tell you, I couldn't figure out what to do
> > > > > with the information.
> > > > >
> > > > > Am I supposed to make use of "cfajaxproxy" tag or Spry or what?
> > > > > From looking at the example in the docs for using an asynchronous
> > > > > CFC proxy, it's quite complicated.  Will I have to learn how
> > > > > to loop over the data from the ajax call using javascript to be
> > > > > able to use the data on my calling page?
> > > > >
> > > > > I hope there's a much simpler answer than what I'm suspecting.
> > > > > I was just hoping I'd be able to use the struct (structSchedule
> > > > > in my code) much like I would a cfquery.
> > > > >
> > > > > Rick
> 

Re: This CFC function and jQuery Ajax stuff is killing me...

2009-02-04 Thread Charlie Griefer

On Wed, Feb 4, 2009 at 12:31 PM, Rick Faircloth wrote:

>
> PS - When all you've got is a hammer,
> everything looks like a nail!
>


PPS - that's not a "good thing" :)

-- 
I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


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


RE: This CFC function and jQuery Ajax stuff is killing me...

2009-02-04 Thread Rick Faircloth

> well now you sound like my wife

Well, according to your tagline, you love your wife,
so I guess I'm in good company!

:o)

PS - When all you've got is a hammer,
 everything looks like a nail!



> -Original Message-
> From: Charlie Griefer [mailto:charlie.grie...@gmail.com]
> Sent: Wednesday, February 04, 2009 2:48 PM
> To: cf-talk
> Subject: Re: This CFC function and jQuery Ajax stuff is killing me...
> 
> 
> On Wed, Feb 4, 2009 at 11:32 AM, Rick Faircloth 
> wrote:
> 
> >
> > Oh, Charlie...you make me sad...
> >
> 
> well now you sound like my wife and her mother.
> 
> 
> > Yeah, I get the server-side vs client-side...I was just
> > hoping that somehow I would get to work with CF code
> > back on the calling page.
> >
> 
> but you can't.  we've established that already.  stop spending time looking
> for that magic bullet and focus on doing whatcha need to do.
> 
> 
> > Why don't you just figure out how we can query the
> > JS data, like a QoQ or something and turn it back into
> > CF data!  I like it!
> >
> 
> if i'm going to spend time figuring out stuff that can't be figured out, i'd
> prefer to spend it figuring out how to regrow my hair.
> 
> 
> > Anyway...I'll live with the limitations...for now.
> >
> > But sooner or later we're going to have to set all this
> > up properly! :o)
> >
> 
> it is proper.  you need a hammer and a screwdriver.  but all you have is a
> hammer.  stop trying to figure out how to properly hammer in the screw, and
> invest in the screwdriver.
> 
> 
> >
> > Thanks for the help!
> >
> > Rick
> >
> 
> --
> I have failed as much as I have succeeded. But I love my life. I love my
> wife. And I wish you my kind of success.
> 
> 
> 

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


Re: This CFC function and jQuery Ajax stuff is killing me...

2009-02-04 Thread John M Bliss

Maybe OT but do you dislike cfgrid?

On Wed, Feb 4, 2009 at 12:57 PM, Rick Faircloth wrote:

>
> Hi, John...and thanks for the reply.
>
> Yes, the data is headed for a table.
>
> I'll be outputting rows set up like this:
>
> Date am/pm position agent
>
> Just those four rows.  This is the first
> time I've tried to output more than single
> elements returned via ajax.  Usually, I can just
> specify what the individual data is for the return,
> such as struct.name, struct.date, etc.  Now I'm trying
> to figure out how to deal with queries, etc.
>
> I wish I could somehow get this back into a structure
> where I could use CF code to deal with it...oh, that
> would be nice...
>
> Rick
>
>
> > -Original Message-
> > From: John M Bliss [mailto:bliss.j...@gmail.com]
> > Sent: Wednesday, February 04, 2009 7:37 AM
> > To: cf-talk
> > Subject: Re: This CFC function and jQuery Ajax stuff is killing me...
> >
> >
> > Can we have some more background?  What are you going to be doing with
> this
> > data once you get it back to the calling page?  A grid or what?
> >
> > On Tue, Feb 3, 2009 at 11:57 PM, James Holmes  >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.
> > >
> > > mxAjax / CFAjax docs and other useful articles:
> > > http://www.bifrost.com.au/blog/
> > >
> > >
> > >
> > > 2009/2/4 Rick Faircloth :
> > > >
> > > > The call that I've been using is
> > > >
> > > > $.ajax({  cache: false,
> > > >  type:  "post",
> > > >  url:
> > > "../components/floor_duty.cfc?method="get_duty_schedule",
> > > >  dataType:  "json",
> > > >  data:  "formval",<--- form values, etc., are put
> into
> > > this variable
> > > >  success:   function(response) {
> > > >
> > > > etc...
> > > >
> > > > and in the cfc method, I specify returnFormat = "json".
> > > >
> > > > I looked over the Adobe docs and another resource I found,
> > > > but I've got to tell you, I couldn't figure out what to do
> > > > with the information.
> > > >
> > > > Am I supposed to make use of "cfajaxproxy" tag or Spry or what?
> > > > From looking at the example in the docs for using an asynchronous
> > > > CFC proxy, it's quite complicated.  Will I have to learn how
> > > > to loop over the data from the ajax call using javascript to be
> > > > able to use the data on my calling page?
> > > >
> > > > I hope there's a much simpler answer than what I'm suspecting.
> > > > I was just hoping I'd be able to use the struct (structSchedule
> > > > in my code) much like I would a cfquery.
> > > >
> > > > Rick
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >> -Original Message-
> > > >> From: James Holmes [mailto:james.hol...@gmail.com]
> > > >> Sent: Tuesday, February 03, 2009 10:01 PM
> > > >> To: cf-talk
> > > >> Subject: Re: This CFC function and jQuery Ajax stuff is killing
> me...
> > > >>
> > > >>
> > > >> I should have added that I was wondering how you used jQuery to do
> the
> > > >> Ajax call, since $.getJSON() should automatically convert the JSON
> to
> > > >> data:
> > > >>
> > > >> http://docs.jquery.com/Ajax/jQuery.getJSON
> > > >>
> > > >> mxAjax / CFAjax docs and other useful articles:
> > > >> http://www.bifrost.com.au/blog/
> > > >>
> > > >>
> > > >>
> > > >> 2009/2/4 Rick Faircloth :
> > > >> >
> > > >> > Thanks for the tips, James... I'll see what I can do!
> > > >> >
> > > >> > Rick
> > > >>
> > > >>
> > > >
> > > >
> > >
> > >
> >
> >
>
> 

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


Re: This CFC function and jQuery Ajax stuff is killing me...

2009-02-04 Thread Charlie Griefer

On Wed, Feb 4, 2009 at 11:32 AM, Rick Faircloth wrote:

>
> Oh, Charlie...you make me sad...
>

well now you sound like my wife and her mother.


> Yeah, I get the server-side vs client-side...I was just
> hoping that somehow I would get to work with CF code
> back on the calling page.
>

but you can't.  we've established that already.  stop spending time looking
for that magic bullet and focus on doing whatcha need to do.


> Why don't you just figure out how we can query the
> JS data, like a QoQ or something and turn it back into
> CF data!  I like it!
>

if i'm going to spend time figuring out stuff that can't be figured out, i'd
prefer to spend it figuring out how to regrow my hair.


> Anyway...I'll live with the limitations...for now.
>
> But sooner or later we're going to have to set all this
> up properly! :o)
>

it is proper.  you need a hammer and a screwdriver.  but all you have is a
hammer.  stop trying to figure out how to properly hammer in the screw, and
invest in the screwdriver.


>
> Thanks for the help!
>
> Rick
>

-- 
I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


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


RE: This CFC function and jQuery Ajax stuff is killing me...

2009-02-04 Thread Rick Faircloth

Oh, Charlie...you make me sad...

Yeah, I get the server-side vs client-side...I was just
hoping that somehow I would get to work with CF code
back on the calling page.

Why don't you just figure out how we can query the
JS data, like a QoQ or something and turn it back into
CF data!  I like it!

Anyway...I'll live with the limitations...for now.

But sooner or later we're going to have to set all this
up properly! :o)

Thanks for the help!

Rick

> -Original Message-
> From: Charlie Griefer [mailto:charlie.grie...@gmail.com]
> Sent: Wednesday, February 04, 2009 2:14 PM
> To: cf-talk
> Subject: Re: This CFC function and jQuery Ajax stuff is killing me...
> 
> 
> no no no no no.
> again CF = server side.  JS = client side.
> 
> if you pass JSON -to- the server -from- the client, you can use cfjson to
> create coldfusion structures with it.  Or, if you're on CF8, you can just
> use the built-in deserializeJSON().
> 
> But (again)... if you've SENT data FROM coldfusion TO the client, you are
> now on the client.  At some point  you're going to have to accept that there
> is no client side ColdFusion.  The "J" in AJAX is JavaScript.  If you're
> going to be working with AJAX, you're going to have to bite the bullet at
> some point and roll up your sleeves and work with JavaScript.  Or, yes, you
> can use the built in AJAX functionality within CF.  depending on what you
> need to do it might be robust enough.  But (IMO) the built in AJAX stuff,
> while handy for quick one-offs, is not a replacement for really knowing and
> understanding how to work with AJAX.
> 
> On Wed, Feb 4, 2009 at 4:29 AM, Rick Faircloth 
> wrote:
> 
> >
> > Thanks for the further tips, James...I'm sure it'll all
> > come clear...(eventually :o)
> >
> > So, am I to understand, that after reading
> > http://jehiah.com/projects/cfjson/
> > that CFJSON will translate my json-formatted
> > javascript data returned from an ajax call into
> > CF-formatted data, ready-to-use on my calling page
> > without having to write js translation looping procedures, etc.?
> >
> > In essence, CFJSON was written to solve my problem of getting
> > JSON-formatted data from a CFC back into CF-formatted data so
> > I can use standard CF operations on it?
> >
> > Rick
> >
> >
> > > -Original Message-
> > > From: James Holmes [mailto:james.hol...@gmail.com]
> > > Sent: Wednesday, February 04, 2009 12:58 AM
> > > To: cf-talk
> > > Subject: Re: This CFC function and jQuery Ajax stuff is killing me...
> > >
> > >
> > > 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.
> > >
> > > mxAjax / CFAjax docs and other useful articles:
> > > http://www.bifrost.com.au/blog/
> > >
> > >
> > >
> > > 2009/2/4 Rick Faircloth :
> > > >
> > > > The call that I've been using is
> > > >
> > > > $.ajax({  cache: false,
> > > >  type:  "post",
> > > >  url:
> > "../components/floor_duty.cfc?method="get_duty_schedule",
> > > >  dataType:  "json",
> > > >  data:  "formval",<--- form values, etc., are put into
> > this variable
> > > >  success:   function(response) {
> > > >
> > > > etc...
> > > >
> > > > and in the cfc method, I specify returnFormat = "json".
> > > >
> > > > I looked over the Adobe docs and another resource I found,
> > > > but I've got to tell you, I couldn't figure out what to do
> > > > with the information.
> > > >
> > > > Am I supposed to make use of "cfajaxproxy" tag or Spry or what?
> > > > From looking at the example in the docs for using an asynchronous
> > > > CFC proxy, it's quite complicated.  Will I have to learn how
> > > > to loop over the data from the ajax call using javascript to be
> > > > able to use the data on my calling page?
> > > >
> > > > I hope there's a much simpler answer than what I'm suspecting.
> > > > I was just hoping I'd be able to use the struct (structSchedule
> > > > in my code) much like I would a cfquery.
> > > >
> > > > Rick
> > > >
> > > >
> > > >
> >
> >
> >
> >
> 
> 

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


Re: This CFC function and jQuery Ajax stuff is killing me...

2009-02-04 Thread Charlie Griefer

no no no no no.
again CF = server side.  JS = client side.

if you pass JSON -to- the server -from- the client, you can use cfjson to
create coldfusion structures with it.  Or, if you're on CF8, you can just
use the built-in deserializeJSON().

But (again)... if you've SENT data FROM coldfusion TO the client, you are
now on the client.  At some point  you're going to have to accept that there
is no client side ColdFusion.  The "J" in AJAX is JavaScript.  If you're
going to be working with AJAX, you're going to have to bite the bullet at
some point and roll up your sleeves and work with JavaScript.  Or, yes, you
can use the built in AJAX functionality within CF.  depending on what you
need to do it might be robust enough.  But (IMO) the built in AJAX stuff,
while handy for quick one-offs, is not a replacement for really knowing and
understanding how to work with AJAX.

On Wed, Feb 4, 2009 at 4:29 AM, Rick Faircloth wrote:

>
> Thanks for the further tips, James...I'm sure it'll all
> come clear...(eventually :o)
>
> So, am I to understand, that after reading
> http://jehiah.com/projects/cfjson/
> that CFJSON will translate my json-formatted
> javascript data returned from an ajax call into
> CF-formatted data, ready-to-use on my calling page
> without having to write js translation looping procedures, etc.?
>
> In essence, CFJSON was written to solve my problem of getting
> JSON-formatted data from a CFC back into CF-formatted data so
> I can use standard CF operations on it?
>
> Rick
>
>
> > -Original Message-
> > From: James Holmes [mailto:james.hol...@gmail.com]
> > Sent: Wednesday, February 04, 2009 12:58 AM
> > To: cf-talk
> > Subject: Re: This CFC function and jQuery Ajax stuff is killing me...
> >
> >
> > 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.
> >
> > mxAjax / CFAjax docs and other useful articles:
> > http://www.bifrost.com.au/blog/
> >
> >
> >
> > 2009/2/4 Rick Faircloth :
> > >
> > > The call that I've been using is
> > >
> > > $.ajax({  cache: false,
> > >  type:  "post",
> > >  url:
> "../components/floor_duty.cfc?method="get_duty_schedule",
> > >  dataType:  "json",
> > >  data:  "formval",<--- form values, etc., are put into
> this variable
> > >  success:   function(response) {
> > >
> > > etc...
> > >
> > > and in the cfc method, I specify returnFormat = "json".
> > >
> > > I looked over the Adobe docs and another resource I found,
> > > but I've got to tell you, I couldn't figure out what to do
> > > with the information.
> > >
> > > Am I supposed to make use of "cfajaxproxy" tag or Spry or what?
> > > From looking at the example in the docs for using an asynchronous
> > > CFC proxy, it's quite complicated.  Will I have to learn how
> > > to loop over the data from the ajax call using javascript to be
> > > able to use the data on my calling page?
> > >
> > > I hope there's a much simpler answer than what I'm suspecting.
> > > I was just hoping I'd be able to use the struct (structSchedule
> > > in my code) much like I would a cfquery.
> > >
> > > Rick
> > >
> > >
> > >
>
>
>
> 

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


RE: This CFC function and jQuery Ajax stuff is killing me...

2009-02-04 Thread Rick Faircloth

Thanks for the further tips, James...I'm sure it'll all
come clear...(eventually :o)

So, am I to understand, that after reading
http://jehiah.com/projects/cfjson/
that CFJSON will translate my json-formatted
javascript data returned from an ajax call into
CF-formatted data, ready-to-use on my calling page
without having to write js translation looping procedures, etc.?

In essence, CFJSON was written to solve my problem of getting
JSON-formatted data from a CFC back into CF-formatted data so
I can use standard CF operations on it?

Rick


> -Original Message-
> From: James Holmes [mailto:james.hol...@gmail.com]
> Sent: Wednesday, February 04, 2009 12:58 AM
> To: cf-talk
> Subject: Re: This CFC function and jQuery Ajax stuff is killing me...
> 
> 
> 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.
> 
> mxAjax / CFAjax docs and other useful articles:
> http://www.bifrost.com.au/blog/
> 
> 
> 
> 2009/2/4 Rick Faircloth :
> >
> > The call that I've been using is
> >
> > $.ajax({  cache: false,
> >  type:  "post",
> >  url:   
> > "../components/floor_duty.cfc?method="get_duty_schedule",
> >  dataType:  "json",
> >  data:  "formval",<--- form values, etc., are put into this 
> > variable
> >  success:   function(response) {
> >
> > etc...
> >
> > and in the cfc method, I specify returnFormat = "json".
> >
> > I looked over the Adobe docs and another resource I found,
> > but I've got to tell you, I couldn't figure out what to do
> > with the information.
> >
> > Am I supposed to make use of "cfajaxproxy" tag or Spry or what?
> > From looking at the example in the docs for using an asynchronous
> > CFC proxy, it's quite complicated.  Will I have to learn how
> > to loop over the data from the ajax call using javascript to be
> > able to use the data on my calling page?
> >
> > I hope there's a much simpler answer than what I'm suspecting.
> > I was just hoping I'd be able to use the struct (structSchedule
> > in my code) much like I would a cfquery.
> >
> > Rick
> >
> >
> >



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


RE: This CFC function and jQuery Ajax stuff is killing me...

2009-02-04 Thread Rick Faircloth

Hi, John...and thanks for the reply.

Yes, the data is headed for a table.

I'll be outputting rows set up like this:

Date am/pm position agent

Just those four rows.  This is the first
time I've tried to output more than single
elements returned via ajax.  Usually, I can just
specify what the individual data is for the return,
such as struct.name, struct.date, etc.  Now I'm trying
to figure out how to deal with queries, etc.

I wish I could somehow get this back into a structure
where I could use CF code to deal with it...oh, that
would be nice...

Rick


> -Original Message-
> From: John M Bliss [mailto:bliss.j...@gmail.com]
> Sent: Wednesday, February 04, 2009 7:37 AM
> To: cf-talk
> Subject: Re: This CFC function and jQuery Ajax stuff is killing me...
> 
> 
> Can we have some more background?  What are you going to be doing with this
> data once you get it back to the calling page?  A grid or what?
> 
> On Tue, Feb 3, 2009 at 11:57 PM, James Holmes 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.
> >
> > mxAjax / CFAjax docs and other useful articles:
> > http://www.bifrost.com.au/blog/
> >
> >
> >
> > 2009/2/4 Rick Faircloth :
> > >
> > > The call that I've been using is
> > >
> > > $.ajax({  cache: false,
> > >  type:  "post",
> > >  url:
> > "../components/floor_duty.cfc?method="get_duty_schedule",
> > >  dataType:  "json",
> > >  data:  "formval",<--- form values, etc., are put into
> > this variable
> > >  success:   function(response) {
> > >
> > > etc...
> > >
> > > and in the cfc method, I specify returnFormat = "json".
> > >
> > > I looked over the Adobe docs and another resource I found,
> > > but I've got to tell you, I couldn't figure out what to do
> > > with the information.
> > >
> > > Am I supposed to make use of "cfajaxproxy" tag or Spry or what?
> > > From looking at the example in the docs for using an asynchronous
> > > CFC proxy, it's quite complicated.  Will I have to learn how
> > > to loop over the data from the ajax call using javascript to be
> > > able to use the data on my calling page?
> > >
> > > I hope there's a much simpler answer than what I'm suspecting.
> > > I was just hoping I'd be able to use the struct (structSchedule
> > > in my code) much like I would a cfquery.
> > >
> > > Rick
> > >
> > >
> > >
> > >
> > >
> > >> -Original Message-
> > >> From: James Holmes [mailto:james.hol...@gmail.com]
> > >> Sent: Tuesday, February 03, 2009 10:01 PM
> > >> To: cf-talk
> > >> Subject: Re: This CFC function and jQuery Ajax stuff is killing me...
> > >>
> > >>
> > >> I should have added that I was wondering how you used jQuery to do the
> > >> Ajax call, since $.getJSON() should automatically convert the JSON to
> > >> data:
> > >>
> > >> http://docs.jquery.com/Ajax/jQuery.getJSON
> > >>
> > >> mxAjax / CFAjax docs and other useful articles:
> > >> http://www.bifrost.com.au/blog/
> > >>
> > >>
> > >>
> > >> 2009/2/4 Rick Faircloth :
> > >> >
> > >> > Thanks for the tips, James... I'll see what I can do!
> > >> >
> > >> > Rick
> > >>
> > >>
> > >
> > >
> >
> >
> 
> 

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


RE: This CFC function and jQuery Ajax stuff is killing me...

2009-02-04 Thread Rick Faircloth

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


Re: This CFC function and jQuery Ajax stuff is killing me...

2009-02-04 Thread John M Bliss

Can we have some more background?  What are you going to be doing with this
data once you get it back to the calling page?  A grid or what?

On Tue, Feb 3, 2009 at 11:57 PM, James Holmes 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.
>
> mxAjax / CFAjax docs and other useful articles:
> http://www.bifrost.com.au/blog/
>
>
>
> 2009/2/4 Rick Faircloth :
> >
> > The call that I've been using is
> >
> > $.ajax({  cache: false,
> >  type:  "post",
> >  url:
> "../components/floor_duty.cfc?method="get_duty_schedule",
> >  dataType:  "json",
> >  data:  "formval",<--- form values, etc., are put into
> this variable
> >  success:   function(response) {
> >
> > etc...
> >
> > and in the cfc method, I specify returnFormat = "json".
> >
> > I looked over the Adobe docs and another resource I found,
> > but I've got to tell you, I couldn't figure out what to do
> > with the information.
> >
> > Am I supposed to make use of "cfajaxproxy" tag or Spry or what?
> > From looking at the example in the docs for using an asynchronous
> > CFC proxy, it's quite complicated.  Will I have to learn how
> > to loop over the data from the ajax call using javascript to be
> > able to use the data on my calling page?
> >
> > I hope there's a much simpler answer than what I'm suspecting.
> > I was just hoping I'd be able to use the struct (structSchedule
> > in my code) much like I would a cfquery.
> >
> > Rick
> >
> >
> >
> >
> >
> >> -Original Message-
> >> From: James Holmes [mailto:james.hol...@gmail.com]
> >> Sent: Tuesday, February 03, 2009 10:01 PM
> >> To: cf-talk
> >> Subject: Re: This CFC function and jQuery Ajax stuff is killing me...
> >>
> >>
> >> I should have added that I was wondering how you used jQuery to do the
> >> Ajax call, since $.getJSON() should automatically convert the JSON to
> >> data:
> >>
> >> http://docs.jquery.com/Ajax/jQuery.getJSON
> >>
> >> mxAjax / CFAjax docs and other useful articles:
> >> http://www.bifrost.com.au/blog/
> >>
> >>
> >>
> >> 2009/2/4 Rick Faircloth :
> >> >
> >> > Thanks for the tips, James... I'll see what I can do!
> >> >
> >> > Rick
> >>
> >>
> >
> >
>
> 

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


Re: This CFC function and jQuery Ajax stuff is killing me...

2009-02-04 Thread Matt Williams

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  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


RE: This CFC function and jQuery Ajax stuff is killing me...

2009-02-04 Thread Rick Faircloth

I tried modifying my jQuery for the pattern you have below, but
I'm getting an error.  I'm sure it's because my query is more
involved and I'm not implementing your suggestion correctly.

The error I'm getting is:

s.url.match is not a function
onreadystatechange()()
onreadystatechange()()
onreadystatechange()()
getSchedule()
onmouseup(mouseup clientX=616, clientY=288)
jQuery.readyList.push(function() {returnurl, 
s.async,s.username,s.password);else

I have no clue what that is trying to tell me...

The entire query now looks like this:



   function getSchedule() {

  if  ($('option:selected', '#year').val() == ''
  ||   $('option:selected', '#month').val() == '00')

  { $('#error-month-year').fadeIn(500); }

  else

  { 
 if ( $('#error-month-year').attr('visible', 'visible') )
   
{ $('#error-month-year').fadeOut(250); }

 var formval = { dsn:  '<cfoutput>#application.dsn#</cfoutput>',
 month:$('option:selected', '#month').val(),
 day:  $('#day').val(),
 year: $('option:selected', '#year').val() };

 console.log(formval);

 $.getJSON ({ cache: false,
 url:   
"../components/floor_duty.cfc?method=get_duty_schedule",
 data:  formval,
 success:   function(data) {

   $.each(data, function(structKey, 
structValue) {


  var buildDate = 
structValue['month'] +
structValue['year'] ;


   });


                    }
         });
  }
   };







> -Original Message-
> From: Paul Stewart [mailto:p...@whichfranchise.com]
> Sent: Wednesday, February 04, 2009 10:54 AM
> To: cf-talk
> Subject: Re: This CFC function and jQuery Ajax stuff is killing me...
> 
> 
> Just been reading Learning Jquery so hopefully this can get you on the
> right track
> 
> $(document.ready(function( ) {
> 
> $.getJSON('cfcName.cfc?method=methodName',function(data)
> {
> $.each(data,function(structKey, structValue){var buildDate =
> structValue['month'] + structValue['year'] ; });
> });
> 
> });
> 
> The 1st callback function (in $getJSON method) uses your cfcs returned
> JSON (i.e. data).
> 
> The 2nd callback function belonging to the $.each method has access to
> the current iteration key/value pair of your json(struct).
> 
> Have not tried it but if cfc access set to remote and returnformat =
> json i think it should bear fruit
> 
> Rick Faircloth wrote:
> > Not to overly dramatic, but, I think my head really is
> > about to explode.  I know my blood pressure is sky high!
> > I'm going to conquer this stuff or die trying! (Probably
> > will kill me...)
> >
> > Anyway, I'm trying to return data from a method involving
> > 2 queries of data and some random data via ajax.
> >
> > I'm in *over* my head... I can work with simple stuff, but
> > these functions are getting complex.
> >
> > Here's what I'm setting up to return via :
> >
> > 
> > 
> > 
> > 
> > 
> >
> > 
> >
> > I have no idea if that's how I should be trying to return all that data.
> >
> > Below is what I'm getting in the response tab of firebug:
> > (formatted a little so it's easier to read)
> >
> > As you can see, I'm getting the data, but I can't figure out how to
> > read it back on the calling page.  Is this where "serializeJSON" comes in?
> > I'm using "returnFormat='JSON'" to return and data.
> >
> > Advice?  Suggestions?  Clues?
> >
> > Rick
> >
> > PS - I just realized I'm missing a lot of data.  I should have 4 rows of
> > data in the "QGETSCHEDULE" section for each date in the "QGETDUTYDATES" 
> > section.
> > But that's probably just how I've got the queries set up...
> >
> >
> > {"MONTH":2.0,
> >
> > 

RE: This CFC function and jQuery Ajax stuff is killing me...

2009-02-04 Thread Rick Faircloth

Thanks, Paul!  I'll work with this some, also!

Rick

> -Original Message-
> From: Paul Stewart [mailto:p...@whichfranchise.com]
> Sent: Wednesday, February 04, 2009 10:54 AM
> To: cf-talk
> Subject: Re: This CFC function and jQuery Ajax stuff is killing me...
> 
> 
> Just been reading Learning Jquery so hopefully this can get you on the
> right track
> 
> $(document.ready(function( ) {
> 
> $.getJSON('cfcName.cfc?method=methodName',function(data)
> {
> $.each(data,function(structKey, structValue){var buildDate =
> structValue['month'] + structValue['year'] ; });
> });
> 
> });
> 
> The 1st callback function (in $getJSON method) uses your cfcs returned
> JSON (i.e. data).
> 
> The 2nd callback function belonging to the $.each method has access to
> the current iteration key/value pair of your json(struct).
> 
> Have not tried it but if cfc access set to remote and returnformat =
> json i think it should bear fruit
> 
> Rick Faircloth wrote:
> > Not to overly dramatic, but, I think my head really is
> > about to explode.  I know my blood pressure is sky high!
> > I'm going to conquer this stuff or die trying! (Probably
> > will kill me...)
> >
> > Anyway, I'm trying to return data from a method involving
> > 2 queries of data and some random data via ajax.
> >
> > I'm in *over* my head... I can work with simple stuff, but
> > these functions are getting complex.
> >
> > Here's what I'm setting up to return via :
> >
> > 
> > 
> > 
> > 
> > 
> >
> > 
> >
> > I have no idea if that's how I should be trying to return all that data.
> >
> > Below is what I'm getting in the response tab of firebug:
> > (formatted a little so it's easier to read)
> >
> > As you can see, I'm getting the data, but I can't figure out how to
> > read it back on the calling page.  Is this where "serializeJSON" comes in?
> > I'm using "returnFormat='JSON'" to return and data.
> >
> > Advice?  Suggestions?  Clues?
> >
> > Rick
> >
> > PS - I just realized I'm missing a lot of data.  I should have 4 rows of
> > data in the "QGETSCHEDULE" section for each date in the "QGETDUTYDATES" 
> > section.
> > But that's probably just how I've got the queries set up...
> >
> >
> > {"MONTH":2.0,
> >
> > "QGETSCHEDULE":
> > {"COLUMNS": 
> > ["DUTY_ID","DATE","AM_PM","AGENT_ID","POSITION","FIRST_NAME","LAST_NAME"],
> > "DATA":[[1677,"February, 28 2009 00:00:00","am",18,"primary","Mary","Fail"],
> > [1678,"February, 28 2009 
> > 00:00:00","am",19,"alternate","Rebecca","Nottingham"],
> > [1679,"February, 28 2009 
> > 00:00:00","pm",20,"primary","Renea","Camper"],
> > [1680,"February, 28 2009 
> > 00:00:00","pm",21,"alternate","Verjuana","Underwood"]]},
> >
> > "MESSAGE":"Success",
> > "YEAR":2009.0,
> >
> > "QGETDUTYDATES":
> > {"COLUMNS":["DATE"],
> > "DATA":[["February, 01 2009 00:00:00"],
> > ["February, 02 2009 00:00:00"],
> > ["February, 03 2009 00:00:00"],
> > ["February, 04 2009 00:00:00"],
> > ["February, 05 2009 00:00:00"],
> > ["February, 06 2009 00:00:00"],
> > ["February, 07 2009 00:00:00"],
> > ["February, 08 2009 00:00:00"],
> > ["February, 09 2009 00:00:00"],
> > ["February, 10 2009 00:00:00"],
> > ["February, 11 2009 00:00:00"],
> > ["February, 12 2009 00:00:00"],
> > ["February, 13 2009 00:00:00"],
> > ["February, 14 2009 00:00:00"],
> > ["February, 15 2009 00:00:00"],
> > ["February, 16 2009 00:00:00"],
> > ["February, 17 2009 00:00:00"],
> > ["February, 18 2009 00:00:00"],
> > ["February, 19 2009 00:00:00"],
> > ["February, 20 2009 00:00:00"],
> > ["February, 21 2009 00:00:00"],
> > ["February, 22 2009 00:00:00"],
> > ["February, 23 2009 00:00:00"],
> > ["February, 24 2009 00:00:00"],
> > ["February, 25 2009 00:00:00"],
> > ["February, 26 2009 00:00:00"],
> > ["February, 27 2009 00:00:00"],
> > ["February, 28 200900:00:00"]]}}
> >
> >
> >
> 
> 

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


Re: This CFC function and jQuery Ajax stuff is killing me...

2009-02-04 Thread Paul Stewart

Just been reading Learning Jquery so hopefully this can get you on the 
right track

$(document.ready(function( ) {

$.getJSON('cfcName.cfc?method=methodName',function(data)
{
$.each(data,function(structKey, structValue){var buildDate = 
structValue['month'] + structValue['year'] ; });
});

});

The 1st callback function (in $getJSON method) uses your cfcs returned 
JSON (i.e. data).

The 2nd callback function belonging to the $.each method has access to 
the current iteration key/value pair of your json(struct).

Have not tried it but if cfc access set to remote and returnformat = 
json i think it should bear fruit

Rick Faircloth wrote:
> Not to overly dramatic, but, I think my head really is
> about to explode.  I know my blood pressure is sky high!
> I'm going to conquer this stuff or die trying! (Probably
> will kill me...)
>
> Anyway, I'm trying to return data from a method involving
> 2 queries of data and some random data via ajax.
>
> I'm in *over* my head... I can work with simple stuff, but
> these functions are getting complex.
>
> Here's what I'm setting up to return via :
>
> 
> 
> 
> 
> 
>
> 
>
> I have no idea if that's how I should be trying to return all that data.
>
> Below is what I'm getting in the response tab of firebug:
> (formatted a little so it's easier to read)
>
> As you can see, I'm getting the data, but I can't figure out how to
> read it back on the calling page.  Is this where "serializeJSON" comes in?
> I'm using "returnFormat='JSON'" to return and data.
>
> Advice?  Suggestions?  Clues?
>
> Rick
>
> PS - I just realized I'm missing a lot of data.  I should have 4 rows of
> data in the "QGETSCHEDULE" section for each date in the "QGETDUTYDATES" 
> section.
> But that's probably just how I've got the queries set up...
>
>
> {"MONTH":2.0,
>
> "QGETSCHEDULE":
> {"COLUMNS":   
> ["DUTY_ID","DATE","AM_PM","AGENT_ID","POSITION","FIRST_NAME","LAST_NAME"],
> "DATA":[[1677,"February, 28 2009 00:00:00","am",18,"primary","Mary","Fail"],
> [1678,"February, 28 2009 
> 00:00:00","am",19,"alternate","Rebecca","Nottingham"],
> [1679,"February, 28 2009 
> 00:00:00","pm",20,"primary","Renea","Camper"],
> [1680,"February, 28 2009 
> 00:00:00","pm",21,"alternate","Verjuana","Underwood"]]},
>
> "MESSAGE":"Success",
> "YEAR":2009.0,
>
> "QGETDUTYDATES":
> {"COLUMNS":["DATE"],
> "DATA":[["February, 01 2009 00:00:00"],
> ["February, 02 2009 00:00:00"],
> ["February, 03 2009 00:00:00"],
> ["February, 04 2009 00:00:00"],
> ["February, 05 2009 00:00:00"],
> ["February, 06 2009 00:00:00"],
> ["February, 07 2009 00:00:00"],
> ["February, 08 2009 00:00:00"],
> ["February, 09 2009 00:00:00"],
> ["February, 10 2009 00:00:00"],
> ["February, 11 2009 00:00:00"],
> ["February, 12 2009 00:00:00"],
> ["February, 13 2009 00:00:00"],
> ["February, 14 2009 00:00:00"],
> ["February, 15 2009 00:00:00"],
> ["February, 16 2009 00:00:00"],
> ["February, 17 2009 00:00:00"],
> ["February, 18 2009 00:00:00"],
> ["February, 19 2009 00:00:00"],
> ["February, 20 2009 00:00:00"],
> ["February, 21 2009 00:00:00"],
> ["February, 22 2009 00:00:00"],
> ["February, 23 2009 00:00:00"],
> ["February, 24 2009 00:00:00"],
> ["February, 25 2009 00:00:00"],
> ["February, 26 2009 00:00:00"],
> ["February, 27 2009 00:00:00"],
> ["February, 28 200900:00:00"]]}}
>
>
> 

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


Re: This CFC function and jQuery Ajax stuff is killing me...

2009-02-03 Thread James Holmes

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.

mxAjax / CFAjax docs and other useful articles:
http://www.bifrost.com.au/blog/



2009/2/4 Rick Faircloth :
>
> The call that I've been using is
>
> $.ajax({  cache: false,
>  type:  "post",
>  url:   "../components/floor_duty.cfc?method="get_duty_schedule",
>  dataType:  "json",
>  data:  "formval",<--- form values, etc., are put into this 
> variable
>  success:   function(response) {
>
> etc...
>
> and in the cfc method, I specify returnFormat = "json".
>
> I looked over the Adobe docs and another resource I found,
> but I've got to tell you, I couldn't figure out what to do
> with the information.
>
> Am I supposed to make use of "cfajaxproxy" tag or Spry or what?
> From looking at the example in the docs for using an asynchronous
> CFC proxy, it's quite complicated.  Will I have to learn how
> to loop over the data from the ajax call using javascript to be
> able to use the data on my calling page?
>
> I hope there's a much simpler answer than what I'm suspecting.
> I was just hoping I'd be able to use the struct (structSchedule
> in my code) much like I would a cfquery.
>
> Rick
>
>
>
>
>
>> -Original Message-
>> From: James Holmes [mailto:james.hol...@gmail.com]
>> Sent: Tuesday, February 03, 2009 10:01 PM
>> To: cf-talk
>> Subject: Re: This CFC function and jQuery Ajax stuff is killing me...
>>
>>
>> I should have added that I was wondering how you used jQuery to do the
>> Ajax call, since $.getJSON() should automatically convert the JSON to
>> data:
>>
>> http://docs.jquery.com/Ajax/jQuery.getJSON
>>
>> mxAjax / CFAjax docs and other useful articles:
>> http://www.bifrost.com.au/blog/
>>
>>
>>
>> 2009/2/4 Rick Faircloth :
>> >
>> > Thanks for the tips, James... I'll see what I can do!
>> >
>> > Rick
>>
>>
>
> 

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


RE: This CFC function and jQuery Ajax stuff is killing me...

2009-02-03 Thread Rick Faircloth

The call that I've been using is

$.ajax({  cache: false,
  type:  "post",
  url:   "../components/floor_duty.cfc?method="get_duty_schedule",
  dataType:  "json",
  data:  "formval",<--- form values, etc., are put into this 
variable
  success:   function(response) {
 
 etc...

and in the cfc method, I specify returnFormat = "json".

I looked over the Adobe docs and another resource I found,
but I've got to tell you, I couldn't figure out what to do
with the information.

Am I supposed to make use of "cfajaxproxy" tag or Spry or what?
>From looking at the example in the docs for using an asynchronous
CFC proxy, it's quite complicated.  Will I have to learn how
to loop over the data from the ajax call using javascript to be
able to use the data on my calling page?

I hope there's a much simpler answer than what I'm suspecting.
I was just hoping I'd be able to use the struct (structSchedule
in my code) much like I would a cfquery.

Rick





> -Original Message-
> From: James Holmes [mailto:james.hol...@gmail.com]
> Sent: Tuesday, February 03, 2009 10:01 PM
> To: cf-talk
> Subject: Re: This CFC function and jQuery Ajax stuff is killing me...
> 
> 
> I should have added that I was wondering how you used jQuery to do the
> Ajax call, since $.getJSON() should automatically convert the JSON to
> data:
> 
> http://docs.jquery.com/Ajax/jQuery.getJSON
> 
> mxAjax / CFAjax docs and other useful articles:
> http://www.bifrost.com.au/blog/
> 
> 
> 
> 2009/2/4 Rick Faircloth :
> >
> > Thanks for the tips, James... I'll see what I can do!
> >
> > Rick
> 
> 

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


Re: This CFC function and jQuery Ajax stuff is killing me...

2009-02-03 Thread James Holmes

I should have added that I was wondering how you used jQuery to do the
Ajax call, since $.getJSON() should automatically convert the JSON to
data:

http://docs.jquery.com/Ajax/jQuery.getJSON

mxAjax / CFAjax docs and other useful articles:
http://www.bifrost.com.au/blog/



2009/2/4 Rick Faircloth :
>
> Thanks for the tips, James... I'll see what I can do!
>
> Rick

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


RE: This CFC function and jQuery Ajax stuff is killing me...

2009-02-03 Thread Rick Faircloth

Thanks for the tips, James... I'll see what I can do!

Rick

> -Original Message-
> From: James Holmes [mailto:james.hol...@gmail.com]
> Sent: Tuesday, February 03, 2009 9:46 PM
> To: cf-talk
> Subject: Re: This CFC function and jQuery Ajax stuff is killing me...
> 
> 
> You have a properly formed JSON return there. So, it's already serialized.
> 
> You can simply do a JavaScript eval() on the returned data.
> Alternatively, you can include a JSON parser javascript library like
> http://www.json.org/json_parse.js into your code and parse it that
> way. The end result of either will be a JavaScript object.
> 
> Finally, you can simplify a lot of this stuff with what's built in to CF 8:
> 
> http://livedocs.adobe.com/coldfusion/8/htmldocs/ajaxdata_06.html
> 
> mxAjax / CFAjax docs and other useful articles:
> http://www.bifrost.com.au/blog/
> 
> 
> 2009/2/4 Rick Faircloth :
> >
> > Not to overly dramatic, but, I think my head really is
> > about to explode.  I know my blood pressure is sky high!
> > I'm going to conquer this stuff or die trying! (Probably
> > will kill me...)
> >
> > Anyway, I'm trying to return data from a method involving
> > 2 queries of data and some random data via ajax. [snip]
> 
> 

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


Re: This CFC function and jQuery Ajax stuff is killing me...

2009-02-03 Thread James Holmes

You have a properly formed JSON return there. So, it's already serialized.

You can simply do a JavaScript eval() on the returned data.
Alternatively, you can include a JSON parser javascript library like
http://www.json.org/json_parse.js into your code and parse it that
way. The end result of either will be a JavaScript object.

Finally, you can simplify a lot of this stuff with what's built in to CF 8:

http://livedocs.adobe.com/coldfusion/8/htmldocs/ajaxdata_06.html

mxAjax / CFAjax docs and other useful articles:
http://www.bifrost.com.au/blog/


2009/2/4 Rick Faircloth :
>
> Not to overly dramatic, but, I think my head really is
> about to explode.  I know my blood pressure is sky high!
> I'm going to conquer this stuff or die trying! (Probably
> will kill me...)
>
> Anyway, I'm trying to return data from a method involving
> 2 queries of data and some random data via ajax. [snip]

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