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() {return....url,
> 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:
>
> <script>
>
> function getSchedule() {
>
> if ($('option:selected', '#year').val() == '0000'
> || $('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'] ;
>
>
> });
>
>
> }
> });
> }
> };
>
> </script>
>
>
>
>
>
>
>> -----Original Message-----
>> From: Paul Stewart [mailto:[email protected]]
>> 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 <cfreturn ... />:
>>>
>>> <cfset structSchedule.message = "Success">
>>> <cfset structSchedule.month = "#arguments.month#">
>>> <cfset structSchedule.year = "#arguments.year#">
>>> <cfset structSchedule.qGetSchedule = "#qGetSchedule#">
>>> <cfset structSchedule.qGetDutyDates = "#qGetDutyDates#">
>>>
>>> <cfreturn structSchedule />
>>>
>>> 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:318923
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4