这是我的ajax代码:
$('select[id=currency-data]').change(function () {
var currency_id = $(this).val();
$.ajax({
url: "{{Route('exchange-rate')}}",
type: 'POST',
data: {currency_id: currency_id },
success: function(data){
$('#ex-rate').val(data);
}
});
});
查看:
{!! Form::label('currency_id', 'Currency:', ['class' => 'control-label']) !!}
{!! Form::Select('currency_id', $currency_data, Input::old('currency_id'), ['id'=>'currency-data','class' => 'form-control','required']) !!}
{!! Form::label('exchange_rate', 'Exchange Rate:', ['class' => 'control-label']) !!}
{!! Form::input('number','exchange_rate', Input::old('exchange_rate'), ['id'=>'ex-rate','class' => 'form-control','readonly','required']) !!}
当我运行这个程序时,出现了错误:VerifyCsrfToken.php中的TokenMismatchException。请问有人能提供解决方案吗?