i am trying to show the images dynamicaly on remote server. other images are showing with asset()
but i am unable to add the asset() while adding image dynamicaly
here is the code
<img src="{{ asset("' + grandChildColor.adon_item_image + '") }}" alt="' + grandChildColor.adon_item_name + '" style="max-width: 100px;">
and on the server i get the path as follow
src=" + grandChildColor.adon_item_image + '"
how can i solve this?
i was expecting to show the image using asset but i cant get the actual path on remote
2
Answers
Thats how it was solved storing the url in variable and concatinating it with the path inside src
var baseUrl = "{{ url('/') }}";
<label for="grandchild-color-' + key + '"' + '<img src="' + baseUrl + grandChildColor.adon_item_image + '" alt="' + grandChildColor.adon_item_name + '" style="max-width: 100px;"'+ '</label' +
You just need to do this
<img src="{{ assets(grandChildColor.adon_item_name) }}" alt="{{ grandChildColor.adon_item_name }}">
, without adding other quotes