javascript - Submit without submit button after sweetalert message - Laravel -
html:
<form class="btn btn-danger fa fa-trash easy delete" method="post" action="/administrator/slidenamedelete/{{$slidephotos->id}}"> {{ csrf_field() }} <input type="hidden" name="_method" value="patch"> <input type="hidden" name="md_photo" id="md_photo" class="form-control" value=""> </form>
jquery:
<script type="text/javascript"> $(document).ready(function(){ $("form.delete").click(function(){ swal({ title: "are sure?", text: "you not able recover imaginary file!", type: "warning", showcancelbutton: true, confirmbuttoncolor: "#dd6b55", confirmbuttontext: "yes, delete it!", cancelbuttontext: "no, cancel plx!", closeonconfirm: false, closeoncancel: false }, function(isconfirm){ if (isconfirm) { $(this).submit(); } else { swal("cancelled", "your imaginary file safe :)", "error"); } }); }); }); </script>
below code "if (isconfirm)" doesn't work submit action. want submit specific form class have clicked. dont have submit button see in form. best solution problem?
Comments
Post a Comment