I am struggling with my jQuery ajax code. I have a div that should load content from a file when clicked, but nothing is happening. Can someone please review my script and help me identify the mistake?
Here is my JavaScript code:
$(document).ready(function(){
$('#maindiv').click(function(){
$(this).load('q.txt')
});
});
This is my HTML page with a single div element:
<!DOCTYPE html>
<html>
<head>
<title>Ajax Test</title>
<meta charset="UTF-8">
<script type="text/javascript" src="js/aj.js"></script>
<script type="text/javascript" src="js/jquery.js"></script>
</head>
<body>
<div id="maindiv"></div>
</body>
</html>
The content of q.txt simply consists of one word.