function getFile() { $.get("https://epamekids.imtqy.com/README.md", function(data) { $("#text").innerHTML(data); }); } </script> <div id = "text"> <button onclick = "getFile()" id = "button">Get Information</button> </div> 
  • @RazGalstyan this method also prints information instead of a button, and I need to add information to the same <div> below the button, and not instead of it. - Michael
  • @RazGalstyan, so your code, like the code of the author does not work, because in jquery there is no innerHTML method, there is a html method - Grundy
  • @Grundy sorry there was supposed to be html ))). - Raz Galstyan

1 answer 1

You can use the append method to add to the end of the container.

 function getFile() { $.get("https://epamekids.imtqy.com/README.md", function(data) { $("#text").append(data); }); } 
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div id="text"> <button onclick="getFile()" id="button">Get Information</button> </div> 

To add after the selected item, and not inside it, you can use the after method

 function getFile() { $.get("https://epamekids.imtqy.com/README.md", function(data) { $("#text").after(data); }); } 
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div id="text"> <button onclick="getFile()" id="button">Get Information</button> </div>