display image using the ajax json data in blade file laravel

 


   <img src="" id="pimage" height="100px" width="100px" alt="">

<script>
    function productview(id){
        $.ajax({
            url:"{{ url('cart/product/view') }}/"+id,
            type:"GET",
            dataType:"json",
            success:function(data){
                $('#pimage').attr('src','/storage/'+data.product.product_image_1)

            }
        });
    }
</script>

Post a Comment

أحدث أقدم