I have a logout button in my navber.blade.php:
<a class="dropdown-item" id="logout" href="{{ route('admin.logout') }}">
{{ __('Logout') }}
</a>
I want that when I click the logout button, it will show me a confirmation message prompting whether you want to logout - (yes or no)? How to do this with jQuery or javascript?
Edit: I have add this jQuery code
<script>
$(document).on("click", "#logout", function(e) {
e.preventDefault();
var link = $(this).attr("href");
$.confirm({
title: 'Confirm!',
content: 'Simple confirm!',
buttons: {
confirm: function () {
$.alert('Confirmed!');
},
cancel: function () {
$.alert('Canceled!');
},
somethingElse: {
text: 'Something else',
btnClass: 'btn-blue',
keys: ['enter', 'shift'],
action: function(){
$.alert('Something else?');
}
}
}
});
});
</script>
For logout it's showing message
But not logging out.
Note: I am just beginner of jQuery
I have missed to added
<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
This link