使用 jquery 获取当前动态轮播详细信息

Getting current dynamic carousel detail using jquery

我想获取当前轮播的详细信息。

<input type="hidden" name="business_id" value="">
<div id="carouselExampleControls" class="carousel slide" data-ride="carousel" style="display:none">
    <div class="carousel-inner">
        @foreach(Auth::user()->businesses as $key => $biz)
            <div class="carousel-item {{$key == 0 ? 'active' : '' }}">
                {{-- <img src="{{url('images', $slider->image)}}" class="d-block w-100"  alt="...">  --}}
                <div class ="public_clinic_post" data-business="{{$biz->id}}">
                    <h6 class="sub-title">著者 : {{$biz->display_business_name}}</h6>
                </div>
            </div>
        @endforeach
    </div>
    <a class="carousel-control-prev" href="#carouselExampleControls" role="button" data-slide="prev">
        <i class="fas fa-chevron-left"></i>
    </a>
    <a class="carousel-control-next" href="#carouselExampleControls" role="button" data-slide="next">
        <i class="fas fa-chevron-right"></i>
    </a>
</div>   

单击指示器时,它会将业务显示为轮播元素。我想在输入 'business_id'

中获取商家 ID
<input type="hidden" name="business_id" value="">

对我来说不是这样的!

$('#carouselExampleControls').bind('slid.bs.carousel', function (e) {
    let business_id = $(this).find('.active').find('.public_clinic_post').data('business');
    $('[name="business_id"]').val(business_id);
});