I have inside the blade
file a list of options and i'm trying to navigate the url that corresponds to the value
selected. My code below doesn't work because i don't know how i'm gonna passe the value of the function to the route
parameters because i have an error of
Undefined constant 'zone'.
How can i do that ?
<select name="zone" autocomplete="off" class="custom-select" id="s1" ss-deselect="true" onchange="updateZoneUrl(this.value)">
<option data-placeholder="true">Zone</option>
@foreach ($zones as $key => $zone)
<option value="{{ $key }}">{{ $zone }}</option>
@endforeach
</select>
<script>
var updateZoneUrl = (zone) => {
if (zone) {
window.location.href = {{ route(Route::current()->getName(), ['zone' => zone]) }};
}
}
</script>