$(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)