...or simply do a synchronous request.

On Wed, Oct 22, 2008 at 10:00 PM, ricardobeat <[EMAIL PROTECTED]> wrote:
>
> This question should be asked at http://groups.google.com/group/jquery-en
> I suppose.
>
> I assume you're doing something like:
>
> function(){
>   //do something
>   if ( test() ) // do something else
> }
>
> Just split it in two, and get the second part to be the ajax callback:
>
> function doSomething(){
>   //blabla
>   $.ajax({ ... success: doSomethingElse } //make sure it's in scope
> }
> function doSomethingElse(){
>  //blabla
> }
>
> - ricardo
>
> On 22 out, 06:24, bucheron <[EMAIL PROTECTED]> wrote:
>> Hi everyone,
>>
>> here is my problem:
>> I would like to get a return value of test() given by the callback
>> function.
>> The problem I have is because the scope of the callback doesn't
>> interact with the test function so I'm not able to interact between
>> them.
>>
>> here is my function:
>>
>> Code:
>> function test(){
>>       $.ajax({
>>          type: "POST",
>>          url:"/ajax/test/",
>>          data: { ...]
>>          dataType: "json",
>>          success: function(data){
>>             return true;
>>
>>          }
>>       });
>>    }
>>
>> }
>>
>> How would be possible to get the return value of the callback function
>> in test() function in order to make something like:
>>
>> Code:
>> function test(){
>>       return $.ajax({
>>          type: "POST",
>>          url:"/ajax/test/",
>>          data: { ...}
>>          dataType: "json",
>>          success: function(data){
>>             return true;
>>
>>          }
>>       });
>>    }
>>
>> }
>>
>> In advance thanks
>
> >
>



-- 
E. Myller ( www.emyller.net )

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to