I'm starting now in javascript and ajax so there's a lot that I still have doubts
I created an infinite scroll system but what I am not able to create is:
when you reach the end of the column or (there is nothing else to display)
You want ajax to include a php file where for example there will be a div footer with site data
I can show you a msg at the end but msg keeps repeating every time I try to open the window.
$(document).ready(function() {
var win = $ (window);
// Each time the user scrolls
win.scroll(function() {
// End of the document reached?
if ($(document).height() - win.height() == win.scrollTop()) {
$('#loading').show();
var id = $(".tm:last").attr("id");
var cat = $(".tm").attr("cat");
$.ajax({
url: 'load2.php?id='+id+'&cat='+cat,
dataType: 'html',
success: function(html) {
if(html){
$('#posts').append(html);
$('#loading').hide();
}else{
---- aqui que esta a treta !!! ----
$('#posts').append("<center><h1 style='color:red'>End of countries !!!!!!!</h1></center>");
}
}
});
}
});
});