How to use jQuery AJAX External file.

Aug 11 2019 7:35 AM
Here is my code.
What's wrong with my code. it does not show  demo_test.txt content in div1.
Please help me. 
 
 
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.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>

Answers (3)