0
後、私はテーブルを持っている:私はアンカーをクリックするとリセットモーダル内容オープン
<table class="table table-striped">
<thead>
<tr>
<th>Naam</th>
<th>E-mail</th>
<th>Verwijderen</th>
</tr>
</thead>
<tbody>
@foreach($customers as $customer)
<tr>
<td><a href="{{ route('admin_customers_single', $customer->id) }}">{{ $customer->name }}</a></td>
<td>{{ $customer->email }}</td>
<td><a href="{{ route('admin_customers_delete', $customer->id) }}"><span class="glyphicon glyphicon-trash"></span></a></td>
</tr>
@endforeach
</tbody>
</table>
、モデルがデータを開きます。
$(document).on('click', 'a', function (event) {
event.preventDefault();
var url = $(this).attr('href');
$.ajax({
dataType: 'json',
type: 'GET',
url: url,
success: function (data) {
console.log(data);
$('#nameInput').val(data.name);
$('#genderInput').val(data.gender);
$('#addressInput').val(data.address);
$('#zipCodeInput').val(data.zip_code);
$('#cityInput').val(data.city);
$('#countryInput').val(data.country_id);
$('#languageInput').val(data.language);
$('#emailInput').val(data.input);
$('#myModal').modal('show');
}
});
});
データが表示されるので機能します。
<a class="btn btn-primary" href="#" data-toggle="modal" data-target="#myModal" role="button">@lang('admin.customers_new')</a>
このアンカーをクリックすると、データが残って..です は、どのように私は、そのデフォルトのコンテンツへのモーダルをリセットするのですか?
私の答えはあなたを助けていますか? –