0

try {
  $.when(checkStatusErr(statusReference, accepted)).done(function(data) {
    alert(statusReference + "   " + data);
    boolValue = data;
    return data;
  }).fail(function(err) {
    return itemCheckFailed();
  });
}

Hello,

this is my code. "data" is true. I want to get "true" outside the done function to the function above as the return value. How to do it right? The value behind data is exactly what I want but I can´t use it as the return value to the function around it.

I tried callback already but it seems to me that I use it the wrong way.

Thanks for any help!

Felix Zeidler
  • 13
  • 1
  • 5
  • 1
    http://stackoverflow.com/questions/14220321/how-to-return-the-response-from-an-asynchronous-call – epascarello Nov 11 '15 at 22:41
  • 1
    There is a reason why you have to pass a callback. If the data could simply be returned to the caller, there wouldn't be a need for a callback. Read the linked question to understand what the callback is for and how to structure your code. – Felix Kling Nov 11 '15 at 22:46

0 Answers0