Laravel中用Ajax传值出现“CSRF token mismatch.”
原始代码
<input type="text" onchange="changeOrder()" class="order" value="{{ $category->cate_order }}"> </td>
<script type="text/javascript">
function changeOrder(){
$.post("{{ url('admin/category/changeorder') }}",{},function(data){
});
}
</script>
修改jquery,传入token值
<script type="text/javascript">
function changeOrder(){
$.post("{{ url('admin/category/changeorder') }}",{'_token':"{{ csrf_token() }}"},function(data){
});
}
</script>