I learn jQuery ajax, but is not working. I’m click on the div, but nothing happens.
Please help me finding where I have made mistake.
js script:
$(document).ready(function(){
$('#maindiv').click(function(){
$(this).load('q.txt')
});
});
html page with one div:
<!DOCTYPE html>
<html>
<head>
<title>Ajax</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>
q.txt have a one word.
Your jQuery file needs to be loaded first. If you look at the console I am sure you would get a $ is not defined error.