After approve button the alert message will appear and has 2 option button "ok" and "cancel". after clicking ok the page will reload, the problem is I can’t do multiple approval because after clicking the alert ok button the page will reload.
I tried the onclick function but it still reloading after i click the approve button, also tried to remove the alert (data-confirm) but still reload the page.
I’m using these line of code:
<button type="submit" name="status" value="2" class="btn btn-success btn-sm m-b-0-0 waves-effect waves-light" data-confirm="Are you sure you want to approve this leave application?" title="Approve">
<i class="fa fa-check"></i>
</button>
This is the output of button:
How can I multiple approve without appearing of alert but it still record the data?
after i click the check button the pending must change into aprrove, how to do that without reloading or refreching the page?
these is the whole code of the image
2
Answers
To achieve multiple approvals without the alert message and page reload, you can use JavaScript to handle the form submission asynchronously.
If you have
Ok
andCancel
buttons, You should be usingform
element.When a form is sumbitted, page reloads automatically.
To prevent Page reload after
Ok
button is clicked,You should use preventDefault() method
html file:
JavaScript file:
if you want inline Javascript, place
script
tag inside ahead
tags