У меня есть таблица, состоящая из значения. Так что в каждом ряду есть дублирующаяся кнопка. Когда пользователь pu sh дублирует кнопку, он отправит значение всплывающему меню sweetalert2. Но это не получает значение. Я уже вызываю {{item->description}}
внутри текста в sweetalert, но он не передает значение? Как пройти это? Я передаю кнопку {{item->id}}
на дубликате, но она не работает.
html
<table class="table table-striped">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Description</th>
<th scope="col">Plan</th>
<th scope="col">From</th>
<th scope="col">To</th>
<th scope="col">Amount (RM)</th>
<th scope="col">Action</th>
</tr>
</thead>
<tbody>
<?php $count = 1; ?>
@foreach ($packages as $item)
<tr>
<th scope="row">{{$count++}}</th>
<td>{{$item->description}}</td>
<td>{{$item->Plan->name}}</td>
<td>{{$item->from}}</td>
<td>{{$item->to}}</td>
<td>{{$item->price}}</td>
<td>
<a class="btn btn-xs btn-dark" href="/admin/insurance/product/package/edit/{{$product->id}}/{{$item->id}}">Edit</a>
<a class="deletePlanRecord btn btn-xs btn-danger" data-id="{{ $item->id }}"
id="delete" href="#">Delete</a>
<a class="duplicatePlanRecord btn btn-xs btn-danger" data-id="{{ $item->id }}"
id="delete1" href="#">Duplicate</a>
</td>
</tr>
@endforeach
</tbody>
</table>
javascript
$( ".duplicatePlanRecord" ).click(function(e) {
Swal.fire({
title: 'Are you sure to duplicate the plan?',
text: 'try {{$item->description}}',
input: 'text',
inputAttributes: {
autocapitalize: 'off'
},
showCancelButton: true,
confirmButtonText: 'Look up',
showLoaderOnConfirm: true,
preConfirm: (login) => {
return fetch(`//api.github.com/users/${login}`)
.then(response => {
if (!response.ok) {
throw new Error(response.statusText)
}
return response.json()
})
.catch(error => {
Swal.showValidationMessage(
`Request failed: ${error}`
)
})
},