这是视图刀片。如何从控制器中的视图刀片的jQuery循环中获取数据
$('.abc:checked').each(function() {
$.ajax({
type: 'POST',
url: 'TEST',
data: {
'_token': token,
'ruledetail': $(this).attr("name"),
'rule': $(this).attr("data"),
'amount': $(this).attr("amount"),
'total': total,
},
success: function(data) {
console.log(data);
},
});
});
这是我的控制器,我尝试获取数据并将其与循环分开
public function testsenddata(Request $request)
{
$get = array(
'ruledetail' => 'ruledetail',
'rule' => 'rule',
'amount' => 'amount',
'total' => 'total',
// 'value' => 'value',
);
$t = $request->ruledetail;
$t2 = $request->rule;
$t3 = $request->amount;
$t4 = $request->total;
return response()->json(['data1' => $t,'data2' => $t2,'data' => $t3,'total' => $t4]);
}
有可能吗?抱歉我的英语水平