Cheese and Crackers!
Ok, I see what to do now. In the past the callback handler would toss me the
query I requested and then I would continue processing. Now all I need to do it
seems is:
var uInfo = getUserInfo(id)
...continue processing
function getUserInfo(id)
{
foo.setSyncMode();
return foo.method1(); }
So I suppose what I had backwards was the callback is used to allow
asynchronous processing but if I want synchronous I don't bother with it.
----- Original Message -----
From: "Matthew Woodward" <[email protected]>
To: [email protected]
Sent: Tuesday, March 13, 2012 2:05:08 AM
Subject: Re: [OpenBD] setAsyncMode vs setSyncMode
On Mon, Mar 12, 2012 at 10:49 PM, < [email protected] > wrote:
That is just it, they aren't running Synchronous (unless I am getting it
backwards).
If you run things synchronously, there is no callback. Does that answer your
question? You'd just set sync mode and call your methods in sequence.
<blockquote>
I want to send a request to a CFC and then wait for my answer, and then
continue my processing.
</blockquote>
Which is what sync mode is for.
<blockquote>
In the code case, I send my request, via getUser(id), which calls the function
that fires the CFC and then the return is captured. Back when I was using
CFCAjax it was waiting for the return, now that I moved to CFAJAXPROXY it is
not waiting, no matter what I set (setAsyncMode or setSyncMode)
and to quote the site:
setSyncMode - Sets the mode of network operation to be synchronized. This means
the page will wait until the server responds with the result
</blockquote>
Well first of all, don't compare anything you're doing now with CFCAjax.
But as I said before, using sync mode and using a callback method are mutually
exclusive. Check the examples here:
http://www.openbd.org/manual/?/tag/CFAJAXPROXY
If you want to call a method, get the response, then call another method, you'd
just do:
foo.setSyncMode();
foo.method1();
foo.method2();
In that case method1 and method2 would run in sequence since it wouldn't
proceed with method2 until method1 finished.
You'd only use a callback method if you wanted the page to NOT wait for the
response from the server, and the callback method would be called *whenever the
response comes* as opposed to your page waiting for a response. --
Matthew Woodward
[email protected]
http://blog.mattwoodward.com
identi.ca / Twitter: @mpwoodward
Please do not send me proprietary file formats such as Word, PowerPoint, etc.
as attachments.
http://www.gnu.org/philosophy/no-word-attachments.html
--
online documentation: http://openbd.org/manual/
google+ hints/tips: https://plus.google.com/115990347459711259462
http://groups.google.com/group/openbd?hl=en
--
online documentation: http://openbd.org/manual/
google+ hints/tips: https://plus.google.com/115990347459711259462
http://groups.google.com/group/openbd?hl=en