我正在使用AJAX从另一个页面引入旋转木马,但它似乎带来了我需要的3个元素实例。我试着打电话给ID,然后是Class,但我仍然很短。
这个元素
<div id="carousel-thumb" class="carousel slide carousel-fade carousel-thumbnails" data-ride="carousel">
<!--Slides-->
<div class="carousel-inner" role="listbox">
<div class="carousel-item carousel-item-next carousel-item-left">
<a href="/img/charlotteswebclose.jpg" data-fancybox="gallery">
<img class="img-fluid" src="/img/charlotteswebclose.jpg " alt="First slide">
</a>
</div>
<div class="carousel-item active carousel-item-left">
<a href="/img/charlottesweb.jpg" data-fancybox="gallery">
<img class="img-fluid" src="/img/charlottesweb.jpg " alt="Second slide">
</a>
</div>
<!--/.Slides-->
</div>
<!--Controls-->
<a class="carousel-control-prev" href="#carousel-thumb" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#carousel-thumb" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
JS
$(document).ready(function() {
//Press Button
$('#button' + index).on('click', function() {
$('.prodmodal').attr('id', id);
$('.prodmodal .modal-title').html(cardName);
$('.prodmodal .card_info').html(str);
$('#prinfo').attr('href', url);
$.ajax({
url: url,
success: function(result) {
$(".prodmodal .add_to_cart").html($(result).find('.member-div-dis'));
$("#pics").html($(result).find('#carousel-thumb'));
console.log("complete");
}
});