我在数据表中显示数据时遇到问题,如果我将数组直接放入其中就可以了
$id = $request->id;
$find = Presal::find($id);
$find->user_id = $request->customer_id;
$find->proposalid = $request->proposalid;
$psal = $find->save();
if ($psal) {
foreach ($request->service_item_id as $key => $n) {
$find->proposalService()->updateOrCreate([
'service_item_id' => $request->service_item_id[$key],
'start_date' => $request->start_date[$key],
'end_date' => $request->end_date[$key],
'service_type_id' => $request->service_type_id[$key],
'vendor_submit' => $request->vendor_submit[$key],
]);
}
}
但当我使用变量时,它不是它说的读取错误docs https://datatables.net/manual/tech-notes/4 我不明白这里发生了什么
$.parseJSON("[[\"1\",\"New Zealand\",\"20\"],[\"2\",\"Australia\",\"30\"]]");