$(document).ready(function(){

    $("#referenciasMZ").change(function(){
        var age = $('#referenciasMZ').val();

        if(age == 2019){ //Año en que buscar
            $.ajaxSetup({
            headers: {
            'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
            }
            });

            $.ajax({
                type: 'GET',
                url: 'ageRefAnt2019',
                data: {
                    'age': age,
                },
                success:function(result){
                        $('#selectRef').html(result);
                },error:function (xhr, ajaxOptions, thrownError){
                    if(xhr.status==404) {
                        alert(thrownError);
                    }
                }
            });
        }
    });
});