location.href in double quote : Laravel 5.2 -
my code select below
<select id="ddllanguages" class="form-control"> @foreach($languages $language) <option onchange="location.href = {!! url('tr/' . '/' . $language->lid) !!}" value="{!! $language->languageid !!}">{!! $language->language !!}</option> @endforeach </select> this produces below html
<select id="ddllanguages" class="form-control"> <option onchange="location.href = http://localhost/learning/public/translation/1" value="1">english</option> <option onchange="location.href = http://localhost/learning/public/translation/2" value="2">french</option> </select> problem part "location.href = http://localhost/learning/public/translation/1" missing formatting in url.
can guide me correct path?
change this:
<option onchange="location.href = {!! url('tr/' . '/' . $language->lid) !!}" value="{!! $language->languageid !!}">{!! $language->language !!}</option> to this:
<option onchange="location.href = '{!! url('tr/' . '/' . $language->lid) !!}'" value="{!! $language->languageid !!}">{!! $language->language !!}</option> the url pass location.href must string, why need surround entire url single quotes.
Comments
Post a Comment