There are buttons that, when clicked, dynamically update part of the content. When you click on one button displays one content, when you click on another button another content. What I want to get is that one content is always open, then when you click on another, the other is open (via mysql). I can not realize how you can blind from this what I want.

$(document).ready(function(){ $('#btn1').click(function(){ $.ajax({ url: "page1.html", cache: false, success: function(html){ $("#content").html(html); } }); }); $('#btn2').click(function(){ $.ajax({ url: "page2.html", cache: false, success: function(html){ $("#content").html(html); } }); }); $('#btn3').click(function(){ $.ajax({ url: "page3.html", cache: false, success: function(html){ $("#content").html(html); } }); }); }); 
  <form> <input id="btn1" type="button" value="Страница 1"> <input id="btn2" type="button" value="Страница 2"> <input id="btn3" type="button" value="Страница 3"> </form> <div id="content"></div> 

    1 answer 1

     $('#btn1').trigger('click'); 

    At the very end. This simulates a click on the first button, which in turn leads to an ajax request.