My web application has a process where members can submit an application to join that needs to be approved.
One of the options that moderators can use is 'Permanently Reject' - due to the nature of this I want to add some confirmation to this in case they accidentally hit it.
I'm using Sweet Alert to do this and have added the CSS and JS from Sweet Alert and then used the below for the confirmation:
<script type="text/javascript">
$(document).ready(function() {
$('#permreject').on('click', function(e) {
e.preventDefault();
var form = $(this).parents('form');
swal({
title: "Are you sure?",
text: "The member's application will be permanently denied!",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Yes, deny them!",
closeOnConfirm: false
}, function(isConfirm){
if (isConfirm) {
form.submit();
}
});
});
});
</script>
The sweet alert pops up with the correct message, but when I confirm the page seems to load and then returns a blank page and I don't know why.
Here is the form that this belongs to:
<form method="POST" action="http://localhost/my_app/public/application/moderate/2" accept-charset="UTF-8">
<input name="_method" type="hidden" value="PUT">
<input name="_token" type="hidden" value="BfnG2HLkDSC8HSrA2hUAfEn1WDleutAv63BCn4CV">
<input name="memberid" type="hidden" value="2">
<input name="form" type="hidden" value="approvereject">
<input class="btn btn-success" name="buttonid" id="buttonid" value="Approve" type="submit">
<input class="btn btn-danger" name="buttonid" id="buttonid" value="Reject" type="submit">
<input class="btn btn-warning" name="buttonid" id="buttonid" value="Temporarily Reject" type="submit">
<input class="btn btn-danger" name="buttonid" id="permreject" value="Permanently Reject" type="submit">
<textarea placeholder="Reason why you're rejecting... please be specific as the member will read this" class="form-control" name="rejectreason" cols="50" rows="10"></textarea>
</form>
This was working fine before I added Sweet Alert and nothing is showing as an error in my Laravel log or local Apache log.
Can anyone see why the page is just loading blank?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire