Processing responses on JQuery Ajax requests to return them

I’m in a bit of a problem, I have a function that sends an ajax request.
I have seen the other questions regarding this topic, but it seems that the answers doesn’t solve my problem.

function callXHR(params)
    var req = $.post(params.url,;   

    // process for success

       // response processing

    // this function needs to return the processed response from
    // my req.success
    return; //<the value processed on the req.success>;


I have already studied the concept of deferred objects and promises. The thing is i just don’t know how to wait for the ajax call to be resolve before i return the values and end my function.

thank you very much!


Source: jquery

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.