Load HTML from a remote file and inject it in to the DOM load(url,data,callback) .post(url,data,callback) .get(url,data,callback,type) load(url,data,callback,type) code example

Example: jQuery - AJAX load() Method

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
  $("button").click(function(){
    $("#div1").load("demo_test.txt");
  });
});
</script>
</head>
<body>

<div id="div1"><h2>Let jQuery AJAX Change This Text</h2></div>

<button>Get External Content</button>

</body>
</html>

Tags:

Html Example