I'm using a slick slider. While I'm calling a HTML part which have slick slider using AJAX call it is not working. I've mentioned my code as below:
$(document).ready(function(){
var year = $("#year").val();
if(year == 'all'){
$.ajax({
method: 'post',
url: 'helpData.php',
data: {year:year},
success: function(data){
$("#helpData").html(data);
}
});
}
});
This is an AJAX call.
if ($(this).is(".slider3")){
$(this).slick({
dots: true,
autoplay:true,
autoplaySpeed:1500,
prevArrow: false,
nextArrow: false,
});
}
This code is for slick slider which is in another JS file which I already included.
<?php
foreach ($helpData as $hdata) {
$heData = $help->getAllImg($hdata->heid);
?>
<div class="col-md-6">
<div class="onePost">
<div class="mySlider slider3">
<?php foreach( $heData as $himg ){ ?>
<div class="bannerSlider">
<img src="<?php echo SITE_URL; ?>/img/help/<?php echo $himg->photo; ?>" class="img-responsive otherImages" />
</div>
<?php } ?>
</div>
<a href="highlightpost.php?id=<?php echo $hdata->heid; ?>">
<p class="photoCaption">
<?php echo $hdata->title; ?>
</p>
</a>
<p style="float: right;">
<a href=""><i class="fas fa-share-alt"></i></a>
</p>
</div>
</div>
<?php } ?>
<?php } ?>
This is my helpData.php
code which is called using AJAX.