@phpMick
tried as per your suggestion nothing changes i will paste my code again if you can help please
on the blade i have this
<script type="text/javascript">
$.ajaxSetup({
headers: {'X-CSRF-TOKEN': '{{ csrf_token() }}'},
});
function fetch_select(val)
{
$.ajax({
type: 'post',
url: 'spotCheck',
data: {
'_token': '{!! csrf_token() !!}',
get_option:val
},
success: function (response) {
document.getElementById("new_select").innerHTML=response;
}
});
}
</script>
<script type="text/javascript">
function submit() {
form = document.getElementById('test_form');
form.submit();
}
</script>
{!! Form::Open(['url'=>'spotCheck','files' => true,'id'=>'test_form']) !!}
{{ csrf_field() }}
<div class="form-group">
<div class="row">
<div class="col-xs-8">
{!! Form::label ('Call Sign:',null, ['class'=>"control-label"])!!}
{!! Form::select('call_sign', $drive, null, ['class' => 'form-control' , 'id' => 'sel','onchange' => 'fetch_select(this.value);' ]) !!}
</div>
<div class="col-md-4">
<label class="control-label">Picture</label>
<img src="{{$dphoto}}" alt="with responsive image feature" class="img-responsive img-circle">
</div>
</div>
</div>
<div class="form-group">
<div class="row">
<div class="col-xs-8">
<label class="control-label">Driver Full Name</label>
<input type="text" class="form-control" name="First_Name" id="new_select" />
on the controller
public function getDriverNamePicture()
{
if (Request::ajax())
{
if (Session::token() !== Request::header('csrftoken'))
{
// Change this to return something your JavaScript can read...
throw new Illuminate\Session\TokenMismatchException;
}else if(isset($_POST['get_option']))
{
$state = $_POST['get_option'];
$sql = DB::table('driver')
->select('drvname')
->where('code', $state)
->first()
->drvname;
$new_string = explode('', $sql);
exit;
}
}
return Response::json( $sql);
}
}
on the route I have this
Route::post('spotCheck', 'SpotCheckController@getDriverNamePicture');
I have gone on to add this to my layout file
<meta name="_token" content="{!! csrf_token() !!}"/>
at the footer
<script type="text/javascript">
$.ajaxSetup({
headers: { 'X-CSRF-Token' : $('meta[name=_token]').attr('content') }
});
</script>
on the browser inspection I get this
send @jquery.min.js4
ajax @jquery.min.js4
fetch_select @spotCheck:29
onchange @spotcheck:120
all that i understand what its saying but I get this at the end which i don't understand
Listpicker_handleMouseUp @about;blank:3138