It seems to me that you have two choices: 
1. Save myFirstArg in a global javascript variable before you call
_execute(), then reference the global variable in your callback.
2. Return myFirstArg in the results structure coming back from the
server (which assumes this it's ok to return a Struct from you CFC
function), then pick your results out of the struct.

Changing your CFC function to return a Struct is kind of nice, because
it makes it easy to return lots of things in addition to the "main"
thing you want back.  So, if today the "result" ('r") is a string (or a
Query, or whatever), then change your CFC to do something like this:

<cfscript>
// Pack results into a Struct for returning to the AJAX client...
returnStruct = StructNew();
returnStruct.myFirstArg = arguments.myFirstArg;
returnStruct.mainResult = stringToReturn;
// Return packed results.
return returnStruct;
</cfscript>

Then, in your callback function, just reference the items in the
struct...

Function doQueryResults(r){
  alert(r.myFirstArg);
  alert(r.mainResult);
}


Hope that helps.
        Mark

-----Original Message-----
From: Adkins, Randy [mailto:[EMAIL PROTECTED] 
Sent: Friday, June 30, 2006 3:25 PM
To: CF-Talk
Subject: RE: ajaxcfc and Call back

 From what I gather using the following  you can pass the variable as an
argument.

DWREngine._execute(_ajaxConfig._cfscriptLocation, null, 'doQuery', id,
myfirstArg, doQueryResults);

But the question is in the CallBack routine (doQueryResults), how do I
reference myfirstArg?
R = the query results from the cfc. Is it as simple as (r,firstArg) ?

Function doQueryResults(r){
????
}

-----Original Message-----
From: James Holmes [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 29, 2006 9:55 PM
To: CF-Talk
Subject: Re: ajaxcfc and Call back

You can set it as a global JS variable in the function that does the DWR
call. Alternatively you can pass it in to the doQuery() call and return
it with the other data as part of a struct or an additional column in
the query or however you want.

On 6/30/06, Coldfusion <[EMAIL PROTECTED]> wrote:
> How can I dynamically pass a value from the initial call into the 
> CallBack function?
>
> DWREngine._execute(_ajaxConfig._cfscriptLocation, null, 'doQuery', id,

> doQueryResults);
>
> Otherwirds, I want to pass an Row number into the doQueryResults call 
> back action so it can be used dynamically.
>
>
>
>
>
> 





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:245176
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to