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]); }



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2rigyYb
via IFTTT

Aucun commentaire:

Enregistrer un commentaire