$("#btn").click(function() {
    var data;
    getData();
    // use data...
}
function getData() {
    $.ajax({
        // Usual AJAX key-value pairs...
        success: function(response) {
            // Set data = response
        }
    });
}
How can I store the response to the AJAX request in the data variable declared in the handler function?
I want to use the value returned by the server inside the handler function.
Is there a way I can do this without disabling asynchronous retrieval.
 
    