There is a code that allows when you click on an item to display the contents of another page in a block of the current page. Everything works fine, but I would like the display to be automatically turned on when I go to this page (that is, the first item (active by default) to display information without clicking on the item). Maybe it was crooked, but I think you will understand me)

$(document).ready(function(){ $('#ever').click(function(){ $.ajax({ url: "everything.html", cache: false, success: function(html){ $("#everything").html(html); } }); }); }) 

    1 answer 1

    Just call this function after the page loads:

     var ajaxLoad = function() { $.ajax({ url: "everything.html", cache: false, success: function(html) { $("#everything").html(html); } }); }; $(document).ready(function() { $('#ever').click(ajaxLoad); ajaxLoad(); });