Hi i want to show show payments methods based on country option selected.
i have following code.
FOR COUNTRY SELECTION
$countries = json_decode(file_get_contents(resource_path('views/partials/country.json')));
<select name="country" id="countriess" class="form-control">
<option value="nil"> -- select an option -- </option>
@foreach($countries as $key => $country)
<option data-mobile_code="{{ $country->dial_code }}" value="{{ $country->country }}" data-code="{{ $key }}">{{ __($country->country) }}</option>
@endforeach
</select>
To LOAD GATEWAYS
@foreach($gatewayCurrency as $data) // $data->country has country name from database
@endforeach
I have tried following using jquery
<script type="text/javascript">
$('#countriess').on('change',function(){
if("{{$data->country}}"!=$(this).val()){
$("#country_{{$data->country}}").hide();
}
else if("{{$data->country}}"== $(this).val()){
$("#country_{{$data->country}}").show();
}
else if("{{$data->country}}"!=$(this).val()){
$("#country_{{$data->country}}").hide();
}
});
</script>
but issue is shows some other countries gateways as well if they are 2nd last in database