I have the following code for getting the length of an array using an Ajax call. A callback is used here. However, I keep getting [object Object] instead of the actual count. What am I doing wrong?
var count = countArray().done(handle_countArray);   
alert(count); // shows [object Object]
function handle_countArray(array) {
    var count = array.length;
    alert(count); // gets correct length
    return count; // should return correct length
}
function countArray() {
    return $.ajax({ url: "..." });
}