我是laravel 5.1的初学者。
这是我的代码
route.php
''''''''''
Route::get('/', function(){
$tasks = Task::orderBy('created_at', 'asc')->get();
return view('tasks', Array(
'tasks' => $tasks,
));
});
Route::delete('/task/{id}', function ($id) {
$parameters=Array(
'alert_ada'=>"ada",
'alert_msg'=>"No $id telah dibuang",
);
return redirect('/')->with($parameters);
});
...
view.php
''''''''
<html>
<head>
<script>
alert('{{$alert_msg}}+{{$alert_ada}}');
</script>
</head>
</html>
问题是参数没有显示在view.php
中答案 0 :(得分:1)
我刚解决了!
$res = array();
$res[] = $data['id'];
$res[] = $data['string 1'];
$res[] = $data['string 2'];
$res[] = $data['string 3'];
$res[] = $data['string 4'];
return json_encode($res);