我无法使用引导模式和一些 ajax 将 a 插入到我的数据库中。有人能帮我吗。我收到了一个错误Uncaught SyntaxError: Invalid shorthand property initializer。我一直在寻找一些类似的问题,但我找不到。顺便说一下,我是 AJAX 新手,所以很抱歉。有谁知道如何解决这一问题。TIA
首都
<div class="modal fade" id="exampleModalCenter" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalCenterTitle">Supplier</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<p style="font-weight: bold;">Name </p>
<input style="text-transform:uppercase" type="text" class="form-control" id="supplier"/>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary" id="add_supplier">Add</button>
</div>
</div>
</div>
</div>
控制器
public function store(Request $request)
{
$data = $request->all();
$data['name'] = ($data['name']);
Supplier::create($data);
return response()->json($data);
}
路线
Route::resource('supplier', 'SupplierController');
不负相思意