I'm new to jQuery and Ajax. I'm following a tutorial, and having a problem with this.
I have an anchor tag with id getcomments and the following JavaScript:
<script>
$(function() {
$('#getcomments').click(function() {
$.ajax({
url : "req.html",
success : function(response) {
console.log(response);
}
});
return false;
});
});
And an HTML file called req.html in the same folder with a mock comment.
When I inspect the log I only get the "document" in firebug, and no actual get request.
I've tried doing something actual in the success function also, appending the response.
Nothing happens, what am I doing wrong here?
req.htmllook like?<script>tags are HTML, btw.