lundi 3 décembre 2018

I'm trying to outofill textbox based on dropdown selection in laravel

  1. this is my dropdown selection field inside the form

    Class ID -select- @foreach($aiclasses as $aiclass) option value=""> @endforeach
  2. This is the textbox i want to autofill from db

    Required Fees
  3. this is my ajax code

    @push('js')
    
    
    $(".info_id").change(function() { var id = $(this).val(); $.ajax({ url: '/info/' + $(this).val(), type: 'get', data: {id : 'id'}, success: function(data) { if (data.success === true) { $("#info_id").value = data.info; } else { alert('Cannot find info'); }
    },
    error: function(jqXHR, textStatus, errorThrown) {}
    
    
    }); });

    @endpush

  4. this is my controller

    public function getInfo($id) { $fill = DB::table('aiclasses')->where('id', $id)->pluck('fee'); return \Response::json(['success'=>true, 'info_area'=>$fill]); }



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire