0
我使用JavaScript构建了一个选择框和一个onclick
事件。这是我的JavaScript部分,它接收一个值。如何从route/web.php获取变量到控制器
<script>
$('#spiele').on('change', function(e){
console.log(e);
var spielID = e.target.value;
//ajax
$.get('/spieler-table?spielID=' + spielID, function(data){
//success data
console.log(data);
});
});
</script>
之后,所选择的价值来自于route/web.php
Route::get('/spieler-table', function(){
$spielID = Input::get('spielID');
echo $spielID;
});
我看到控制台正确删除值。 但是下一步对我来说,把变量放到控制器 使用Illuminate \ Http \ Request; 使用App \ Spieler;
class SpielerController extends Controller
{
public function getSpieler(/*var*/){
//Here I need the var!!!
}
}
我需要做些什么来获得这里的变量?