I'm starting out on jquery and ran into a small problem where $.ajax(...) is not working. Actually the whole jquery, javascript business has been tough because of sorting out the problem in case the script doesn't work. this is my code...
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
/* $.ajax({url:"http://reddit.com/r/nyc.json", success:function(result){
$("div").text("helloz");
}});*/
$("div").text("hello");
});
</script>
</head>
<body>
<div><h2>Let AJAX change this text</h2></div>
<button>Change Content</button>
</body>
</html>
as you can see in the code, I have commented out the .ajax function and instead put some other snippet and it works, proving that jquery is loaded fine and the ready function is working well. However, the .ajax function is not working. My internet connection is working fine and the code works perfectly if I paste this code in w3cschool's tryit editor. Can someone please help me.
Also, any general strategies to solve such bug chases would be really helpful. I have chrome browser but when i open the javascript console, it shows everything as working fine...