I want, without pressing a button, to receive a response from the server, that is, to receive a response and use it for the condition. Is it possible?
Button -
<button class="btn btn-success" id="confirmButton" data-tid="0">Button</button> Onclick assigned to the button, sort of like this way -
$("#botFilter .btn").removeClass("active"); $(this).addClass("active"); doFilter(); }); $("#confirmButton").on("click",function(){ inlineAlert("","Confirming trade offer - please wait..."); $this=$(this); $this.prop("disabled",true); var tid=$this.data("tid"); $.ajax({ url:"scripts/_confirm.php", type:"GET", data:{"tid":tid}, success:function(data){ try{ data=JSON.parse(data); if(data.success){ if(data.action=="accept"){ inlineAlert("success",data.result); }else{ inlineAlert("cross",data.result); } In this case, I myself understand bad, please explain in more detail.