I have a blade file which has below reference
@include('Js/login')
In this above file, I have below code
<script>
var processingImageUrl = '<img src="'+ "{!! URL('Images/ajax-loader.gif') !!}" + '" />'
</script>
When I checked the page source, it was like below.
var processingImageUrl = '<img src="' + "{!! URL('Images/ajax-loader.gif') !!}" + '" />'
I am trying to show the app path but due to some reasons it is being printed incorrectly.
Am I missing something?
Looks like its not compiled. The file where your script is added, the file name should end with blade.php. Exmaple - testview.blade.php
You can use direct HTML of laravel for img tag
{{ HTML::image('Images/ajax-loader.gif') }}
or you can add direct path from assets
<img src="{{asset('assets/Images/ajax-loader.gif')}}">
it's working for me
Make a js variable like this in your blade
var pagedefaults = {
ajax_image: "{{ asset('/images/ajax-loader.gif') }}",
}
Use this in your js file
<img src=" + pagedefaults.ajax_image + ">