[Ajax - jQuery] How to return the value from Ajax into a new jQuery value?

[Ajax - jQuery] How to return the value from Ajax into a new jQuery value?

$(document).ready( function() {


    $('#prev').click(function() {

var theResponse = null;
       

        $.ajax({
            type: 'POST',
            url: 'array.php',
            data: 'id=testdata',
            dataType: 'json',
            cache: false,
            success: function(data) {            
                                 
               theResponse = data;
            }//success
        });//$.aja
        return theResponse; 
               
    });//$(prev)

    alert(theResponse);


});//$(document)