如何在更新下拉列表后刷新表格中的数据?

时间:2014-03-24 16:15:16

标签: php jquery ajax laravel laravel-4

所以我有一个表格,我从我的数据库和下拉列表中显示我的数据,我想要的是每次更新下拉列表时更新我的​​表,这是我的行动:

public function index()
{
    $userid = User::lists('id');//here i get the id's of all my users
    $username = User::lists('username');// here i put data to my drop down list
    $services = User::find()->service;//here my table that should be updated

    return View::make('services.index',array('services'=>$services,'username'=>$username));
}

这是我的观点:

<div class="form-group">
    {{ Form::label('user_id', 'User Name') }}
    {{ Form::select('user_id', $username , Input::old('user_id'), array('class' => 'form-control')) }}
</div>

// my table should be updated after update the drop down list
<table class="table table-striped table-bordered">
<thead>
    <tr>
        <td>User ID</td>
        <td>Name</td>
                    // ....
            </tr>
    </thead>
<tbody>
@foreach($services as $key => $value)
    <tr>
        <td>{{ $value->user_id }}</td>
        <td>{{ $value->name }}</td>

0 个答案:

没有答案