$(function(){
    $('#form_edit_profile').submit(function(){
        doEditProfile();
    });
});

function doEditProfile(){
    let dest = baseUrl + "user/updateDataProfileJson",
        data = $('#form_edit_profile').serialize();

    let loaderCall = function(){
        blockUiElement('#form_edit_profile', 'Proses update profile...');
    }
    let loaderClose = function(){
        unblockUiElement('#form_edit_profile');
    }

    processDataJson('POST', dest, data, loaderCall, loaderClose).then(function(data){
        var rc = data.response_code,
            rmsg = data.response_message;
        if(rc == '00'){
            let callbackSccs = function(){
                loadPage(baseUrl + 'user/profile');
            }
            alertSuccess(rmsg, callbackSccs);
        }else{
            alertWarning(rmsg);
        }
    });
}
