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

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -