I will using this approach

function get_data_default(callback){
new Ajax.Request('/adress',
  {
    method:'post',
    asynchronous:true,
    onSuccess: function(data){ callback(data.responseText.evalJSON
(true); },
    onFailure: function(){ alert('Something went wrong...') }
  });
}

function show(){alert(get_data_default());}

var data = null;
function processData(obj){ data = obj; alert(data.abc); }
if(data == null){
get_data_default(processData);
}else{
alert(data.abc);
}

On Dec 20, 7:35 pm, kangur91 <kangu...@gmail.com> wrote:
> My code:
>
> function get_data_default() {
> new Ajax.Request('/adress',
>   {
>     method:'post',
>     asynchronous:true,
>     onSuccess: function(data){ return data.responseText.evalJSON
> (true); },
>     onFailure: function(){ alert('Something went wrong...') }
>   });}
>
>             }
> function show(){alert(get_data_default());}
>
> I want to function get_data_default return data recived from OnSucces
> function. How do that?

--

You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.


Reply via email to