Hello I have an ajax and button delete but im wondering why the modal is not popping up. can you help me please.
I dont have the link also to ajax can you provide me what link should i have thanks
My Button
<button class="delete-modal btn btn-danger" data-id=""
data-client_name="">
<span class="glyphicon glyphicon-trash"></span> Delete
</button>
My Ajax Kindly check my ajax code I think im still missing some code thanks.
<script>
$(document).on('click', '.delete-modal', function() {
$('#footer_action_button').text(" Delete");
$('#footer_action_button').removeClass('glyphicon-check');
$('#footer_action_button').addClass('glyphicon-trash');
$('.actionBtn').removeClass('btn-success');
$('.actionBtn').addClass('btn-danger');
$('.actionBtn').addClass('delete');
$('.modal-title').text('Delete');
$('.did').text($(this).data('id'));
$('.deleteContent').show();
$('.form-horizontal').hide();
$('.dname').html($(this).data('name'));
$('#myModal').modal('show');
});
$('.modal-footer').on('click', '.delete', function() {
$.ajax({
type: 'post',
url: '/archTrashPermanent',
data: {
'_token': $('input[name=_token]').val(),
'id': $('.did').text()
},
success: function(data) {
$('.item' + $('.did').text()).remove();
}
});
});
</script>
My Controller
public function archTrashPermanent($id)
{
$client = Client::find($id);
if($client->forceDelete()){
return redirect('/admin/clients')->with('success','Client and Information Removed !');
}
}
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2PggEcx
via IFTTT
Aucun commentaire:
Enregistrer un commentaire