<script type="text/javascript">
            
    var my_handlers = {

        fill_provinces:  function(){

            var region_code = $(this).val();
            $('#my-province-dropdown').ph_locations('fetch_list', [{"region_code": region_code}]);
            
        },

        fill_cities: function(){

            var province_code = $(this).val();
            $('#my-city-dropdown').ph_locations( 'fetch_list', [{"province_code": province_code}]);
        },


        fill_barangays: function(){

            var city_code = $(this).val();
            $('#my-barangay-dropdown').ph_locations('fetch_list', [{"city_code": city_code}]);
        }
    };

    $(function(){
        $('#my-region-dropdown').on('change', my_handlers.fill_provinces);
        $('#my-province-dropdown').on('change', my_handlers.fill_cities);
        $('#my-city-dropdown').on('change', my_handlers.fill_barangays);

        $('#my-region-dropdown').ph_locations({'location_type': 'regions'});
        $('#my-province-dropdown').ph_locations({'location_type': 'provinces'});
        $('#my-city-dropdown').ph_locations({'location_type': 'cities'});
        $('#my-barangay-dropdown').ph_locations({'location_type': 'barangays'});

        $('#my-region-dropdown').ph_locations('fetch_list');
    });
</script>