AjaxForm beforeSubmit with ajax calls and Alertify plugin

AjaxForm beforeSubmit with ajax calls and Alertify plugin

I'm developing a quite complex validation system, where there have to be two ajax calls to validate uniqness and repeatness of some data. To be clear I require presence book, owner and number fileds but except of presence the combination of these files should be unique (this is when a function should return false) and if the cmbination of book and owner is present in db a confirm dialog should be show to make that this combinations can be doubled. Now when the $.get call are complete the functions moves on and doesn't wait for the user reaction - always returns true. Do you think you cold help?
Here's the code:

  1. var validForm = false;
    var validUnique = false;
    var validSet = false;
    function validateForm() {
        validateTextfield('ib-add-form','owners','',1); //check for presence
        validateTextfield('ib-add-form','number','',1); //check for presence
        validateTextfield('ib-add-form','issued','',4); //check for presence
        validForm = checkValidErrors('ib-add-form');
        $.get(
            '/ajax.php?op=checkIvBookUnique',
            { owner: $('#owners').val(), book: $('#book_id').val(), number: $('#number').val() },
            function(data){
                if(data == 'false'){
                    Alertify.dialog.alert($('#owners option:selected').text() + " już posiada " + $('#book_id').data('name') + " o numerze " + $('#number').val());
                    validUnique = false;
                    return false;
                }else{
                    validUnique = true;
                    $.get(
                        '/ajax.php?op=checkIvBookSet',
                        { owner: $('#owners').val(), book: $('#book_id').val() },
                        function(sdata){
                            if(sdata == 'false') {
                                Alertify.dialog.confirm($('#owners option:selected').text() + " już posiada " + $('#book_id').data('name') + ". Czy chcesz dodać kolejną?", function (e) {
                                    if (e == undefined) {
                                        validSet = true;
                                        return validForm && validUnique && validSet;
                                     } else {
                                        validSet = false;
                                        return false;
                                    }
                                });
                            }else{
                                return validForm && validUnique && validSet;
                            }
                        }
                    );

                }
            }
        );
    }
    function processForm(data){
        if(data.status == '0') {

        } else {
            $('#ib-add-form').clearForm();
        }
        Alert(data.status, data.msg);
    }
    var options = {
        forceSync: true,
        async: false,
        beforeSubmit: validateForm,
        success: processForm,
        type: 'post',
        dataType: 'json',
        url: '/ajax.php?op=inventorybook&action=insert'
    }