I uses following method to product filter code is excute very well for apge loading but when i am sending some html code from controller to view and load using ajax call. It works but after success function. some function can not apply. when i am loading first time my website it works fine and some owl-carousel,owl-theme, owl-loaded, classes apply to div ps-shoe__variant normal but after ajax call it will not loaded and structure of div ps-shoe--variant is disturbed I am confused what happens ?? need solutions
view:
<div class="ps-product__columns">
<div class="ps-shoe__content">
<div class="ps-shoe__variants">
<div class="ps-shoe__variant normal">
<?php
$images=[];
$images = explode(",",$product_data->product_multiple_image);
?>
@foreach($images as $image)
<img src="https://datamansolutions.in/ecommerce/images/{{$image}}" alt="">
@endforeach
</div>
</div>
</div>
</div>
controller:
public function getDetails(Request $request)
{
$product = DB::table('table_subcategory')
->join('table_category','table_subcategory.category_id','=','table_category.category_id')
->join('table_product','table_subcategory.subcategory_id','=','table_product.subcategory_id')
->select('table_product.*','table_category.category_name','table_subcategory.subcategory_name')
->where('table_category.category_id',$request->cat_id)
->get();
$output='';
foreach($product as $product_data)
{
$output .= '<div class="ps-shoe__content">';
$output .= '<div class="ps-shoe__variants">';
$output .= '<div class="ps-shoe__variant normal">';
foreach($images as $image)
{
$output .='<img src="https://datamansolutions.in/ecommerce/images/'.$image.'" alt="">';
}
$output .='</div>';
$output .= '</div>';
$output .= '</div>';
}
echo $output;
}
ajax:
$(document).on('click', '.category_li', function(){
var cat_id = $(this).attr("data-val");
//alert(sub_id);
$.ajax({
type : 'get',
url : '/getDetails',
data:{ 'cat_id': cat_id
},
success:function(data)
{
console.log(data);
$('.ps-product__columns').html(data);
}
});
});