JQuery function return true/false?
<p>I'm trying to verify that some function has successfully finished executing something and then based on return true/false act further.</p>

<p>Real code (EDIT) : I want to cancel some edit request, a function that basically changes status value in the database and only if this function was completed successfully i have another function that displays data before edit. </p>

<pre><code>$(document).ready(function() {
    $('#btn_cancel_edit_details').click(function() {
        var ok = cancel_request_edit();
        if (ok) {
            get_request_details(request_id);
        }
    });
});

function cancel_request_edit(){
    var request_id;
    var status;
    if ($('#lstbx_new_repeat_requests').val().length &gt; 0) {
        request_id = $('#lstbx_new_repeat_requests').val();
        request_status = 'opened';
    } else if ($('#lstbx_approved_repeat_requests').val().length &gt; 0) {
        request_id = $('#lstbx_approved_repeat_requests').val();
        request_status = 'approved';
    } else if ($('#lstbx_declined_repeat_requests').val().length &gt; 0) {
        request_id = $('#lstbx_declined_repeat_requests').val();
        request_status = 'declined';
    }
    var request_data = {
            req_id : request_id,
            req_status : request_status,
            is_ajax : 1
        };
    $.ajax( {
        type : 'GET',
        url : 'Code/f_aa_cancel_edit_request.php?' + + new Date().getTime(),
        data : request_data,
        success : function(response) {
            if (response == 'success') {
                return true;    
            }

            else {
                apprise('Error, please contact support.');
                return false;
            }
        }
    });
    return false;
}
</code></pre>
