Here is the code:
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.min.js"
type="text/javascript"></script>
</head>
<body>
<div class ="click"> Click me <div>
<div class = "file"></div>
<script>
$(document).ready(function(){
$(".click").click(function(){
$.ajax({
beforeSend: function(){
$(".file").html('<img src="a.gif" alt="Smiley face" height="42" width="42">' )
},
url: 'a.txt',
type: "GET",
data: ({
"id" : 0
}),
success:function(results){
console.log("inside success");
$(".file").html('results');
}
});
});
});
</script>
</body>
</html>
Here problem is that success:function never calls up...I am not getting any results..just the spinner...my a.txt
file is in same folder as this html is. the content of a.txt is <br> Hello world <br>
.