You can't do what you want because the Ajax call completes asynchronously -
the function won't know what value to return yet by the time it completes.
You either need to have your return script execute some code as one
responder suggested, or have your onSuccess/onComplete handler call some
other function when it's finished to alert your page that the Ajax call
completed.

Instead of returning the result, call another function instead:

function myCallback(returnValue) {
   /// ajax call completed with returnValue
}

new Ajax.Request(.... {
   onSuccess: function (transport) {
      .....
      myCallback(result);
   }
);

-Fred

On Fri, Jul 4, 2008 at 9:20 AM, cdams <[EMAIL PROTECTED]> wrote:

>
> Hi,
>
> I looked into the web, and I find that this is a common error, but I
> haven't any solution..
>
> My method Ajax.Request is in another method. And for my function(v), I
> need to put a return, false or true.
> I tried with my script, but it doesn't work..
>
> Have you any idea to solve my pb?


-- 
Science answers questions; philosophy questions answers.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to rubyonrails-spinoffs@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to