How to type Image Source {{ URL::to('row.image') }} inside the jQuery foreach loop
function preview() {
var preview = $('#image-preview');
$.get('{{ route('admin.get_image') }}')
.then(function (data) {
var s = '';
data.forEach(function (row) {
s += '<div class="col-lg-2 col-md-4">' +
'<img src="" class="img-fluid" alt="">' +
'<button type="button" class="btn btn-link remove-image" id="' + row.id + '">Remove</button>' +
'</div>'
});
preview.html(s);
})
}
I don't know how to do this. data.forEach(function (row) get all image data and here is one column that name [image:/image/product/123456.jpg]. if I use URL::to then output will be localhost/project/image/product/123456.jpg.
If there is another way to solve this problem then help me.