5 months ago

How to get a value based on a selected variable in an array

Posted 5 months ago by Maximus1

I want to get and display the corresponding value of a selected variable in an array. I think did okay with the code but it is bringing no result. This value should be inputed automatically in the priceamount field when the corresponding fee type is selected.


<td width="40%"><select name="fee_type[]" class="form-control select2" required>
                    <option value="">{{_lang('Select One') }}</option>
                    {{ create_option('fee_types','id','fee_type',old('fee_id')) }}
                    <td><input type="text" class="form-control float-field priceamount" name="priceamount[]"value="0" required></td>

<script type="text/javascript">
            var _token=$('input[name=_token]').val();
            var fee_id = $('select[name=fee_type]').val();
                type: "POST",
                url: "{{url('prices/fee_amount')}}",
                success: function(data){


 public function get_fee_amount(Request $request)
                           $feetype = FeeType::find($request->fee_id)->priceamount;
                           return $feetype;

Now i am trying to get the corresponding priceamount from the fee_type selected but without success. It still does not show or get the priceamount value. Can anyone please help?

Please sign in or create an account to participate in this conversation.