I want that in my view, when selecting something in my dropdown, I execute a method that I have in my controller, it performs another function (query) in my model, which takes a data (int) from a table . I have an error when debugging with chrome, I leave the link of the photo I'm using ajax, in which I'm not very expert in case they can help me out or tell me what I'm doing wrong. Another data my dropdown is inside a form, so I have seen some examples with form with Post which does not help me, since what I want to do is client-side. Since a user will be doing that.
Script
$("#sociedad").change(function(){
$.get("imp/"+event.target.value+"",function(response, sociedad){
console.log(response);
});
});
Routes
Route::resource('venta','VentasController');
Route::get('imp/{id}', 'VentasController@getIva');
View and form
<div class="form-group">
{!!Form::select('msocod_id',['' => '- Seleccione una sociedad -'] +$soci,null, ['class' => 'form-control','id'=>'sociedad', 'name'=>'sociedad'])!!}
</div>
Form
@extends('layouts.principal')
@section('content')
@include('alerts.request')
{!!Form::open(['route'=>'venta.store','method'=>'POST'])!!}
@include('venta.forms.venta')
{!!Form::close()!!}
@section('script')
{!!Html::script('js/script.js')!!}
@stop
@stop