I have this confirm:
<script type="text/javascript">
function ConfirmDelete() {
if (confirm("Are you sure you want to delete?")) {
return true;
}
else {
return false;
}
}
</script>
and then I have my Laravel form:
{!! Form::open(['action' => ['Test\\TestController@destroy', $thread->id], 'method' => 'delete', 'onsubmit' => 'ConfirmDelete()']) !!}
{!! Form::submit('Delete', ['class' => 'btn btn-danger']) !!}
{!! Form::close() !!}
I’m getting the message and if I’m pressing on OK, the thread gets deleted, but that also happens on cancel. What can I do so that nothing happens, if I’m pressing cancel?