Re: Prototype callbacks: return a value

T.J. Crowder
Mon, 30 Jun 2008 10:08:26 -0000

Hi,

Your first one doesn''t work for various reasons.  The second one will
work, but it has the same sync/async problem that your other thread
suffers from.
--
T.J. Crowder
tj / crowder software / com

On Jun 30, 9:51 am, ljundie
<ljun...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:
> hello back, another funny question with prototype callbacks :)
>
> i dont manage to get a callback return a value. the example would be:
>
>
>
> var lucas = 0;
>
> function loadRSS() {
>          var url = "sample_feeds/sample_feeds_TTblog.xhtml";
>          var myAjax = new Ajax.Request( url, {
>
    method: ''get'',
>
    parameters: '''',
>
    onComplete: lucas = processRSS
>
    });
>          }
>
>  function processRSS(xmlHttpRequest, responseHeader) {
>                 value = 1;
>                 return value;
>  }
>
> if (lucas==1) {
>         alert (''ole!'');
>         }
>
>
>
> i''ve also tried, without any result, something like:
> onComplete: function (xmlHttpRequest, responseHeader) {
> lucas = processRSS(xmlHttpRequest, responseHeader);
>                         }
>
> every little help worths :)