When you press a button and confirm, an Ajax request is performed.
function Validator(id_){ if(confirm("Вы подтверждаете операцию?") ){ var ttt= document.getElementById(id_); alert(ttt.id); $.ajax({ type: 'GET', url: '2.php', data:{'1btn':'1'}, success: function(data) { $("p").html(data); } }); return(true); }else{ alert("Операция отменена!"); return(false); } } <p></p> <button id="1btn" class="b1" value="open" onclick="JavaScript:return Validator(this.id);">Start</button> <button id="50btn" class="b1" value="open" onclick="JavaScript:return Validator(this.id);">Stop</button> <button id="51btn" class="b2" value="open" onclick="JavaScript:return Validator(this.id);">Test</button> How in data: {'1btn':'1'} to transfer the value of the variable ttt.id?
data:{1btn:'1', id: ttt},then in php file you get the value of the variable via$_GET("id")- Dmitriy Kondratiuk