There are several buttons:
<button id="49btn" class="b1" value="open" onclick="JavaScript:return Validator();">Start</button> <button id="50btn" class="b1" value="open" onclick="JavaScript:return Validator();">Stop</button> <button id="51btn" class="b2" value="open" onclick="JavaScript:return Validator();">Test</button> There is JavaScript that displays a warning when a button is clicked, if OK - to perform an action with a button, if Cancel - not to perform operations with a button click:
$(document).ready(function(){ $("#51btn").click(function(){ $.ajax({ type: 'GET', url: 'runner.php', data:{'51btn':'0'}, success: function(data) { $("p").html(data); } }); }); }); function Validator(){ if(confirm("Вы подтверждаете операцию?") ){ document.getElementById('id').submit(); return(true); }else{ return(false); } } How to make this warning work for all buttons that have the id value? Ie not to write a function for each button separately. When you press the SPECIFIC button with such an id, a warning should be issued and if OK is pressed in the warning, then the Validator function for a specific button should be executed (ie, only the button that was clicked and OK was pressed in the warning)