I have a basic page, called 'index.php' that has some content on it. When I click on a certain link, it reloads the content of a certain div with the contents of the file called 'blog.php'.
'blog.php' contains a link that has a class attribute = 'more':
<a href="#" class="more" id="<?php echo $id; ?>">load more</a>
And I have the following javascript code, in a separate file called 'loadmore.js'(the connection to this file is made in index.php)
$(function() {
$('.more').on("click",function() {
var ID = $(this).attr("id");
if(ID) {
$("#more"+ID).html('<img src="/./images/loading.gif"/>');
$.ajax({
type: "POST",
url: "/./server_scripts/ajax_more.php",
data: "lastmsg="+ ID,
cache: false,
success: function(html){
$("#main_body").append(html);
$("#more"+ID).remove(); // removing old more button
}
});
}
else {
$(".morebox").html('The End');// no results
}
return false;
})
});
However, when I click on my link and I have breakpoints in my .js file, nothing happens, it just redirects me to the top of the page.
Do you have any idea what might be wrong?