what to do if we want javascript to be executed first then the php post method i.e submitting

Posted by user1447589 on Stack Overflow See other posts from Stack Overflow or by user1447589
Published on 2012-06-10T17:06:54Z Indexed on 2012/06/11 4:40 UTC
Read the original article Hit count: 89

Filed under:
|

For example: I want to accept or reject a photo.

The input button for accept and the form is:

<form method="post" action="viewRequests.php">
    <input type="submit" onClick="showAlertBox()">
</form>

showAlertBox() is a javascript function which shows a confirmation dialog with Yes or No. If I choose No then the form submission should not be triggered.

what to do in this case

© Stack Overflow or respective owner

Related posts about php

Related posts about JavaScript