How to display content from .txt file to div using jQuery load?
I am not sure where I am going wrong. I have div
and button
.
On click button
, I am trying to display the content from a file .txt
in this div
.
HTML:
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<div id='abc'>AA</div>
<button id='bt'>Submit</button>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script type="text/javascript" src="js/app.js"></script>
</body>
</html>
JS:
$('#bt').click(function() {
$('#abc').load('hello.txt');
})
File 'hello.txt'
located in the same folder as the file .html
.
Nothing shows up and I also get no errors.
+3
source to share