php - Auto Load content on scroll down using ajax -
i've built application [php] loads content text & images on scroll down automatically using ajax. code works fine on localhost
, when put on server loads & page dows not load @ or loads content @ once. there alternative can overcome issue?
here's code snippet loads content other page
$(document).ready(function(){ var inc=5; $(window).scroll(function() { if ($('body').height()-190 <= ($(window).height() + $(window).scrolltop())) { inc=inc+3; var datastring = inc; $.ajax({ type: "post", url: "two.php", data: {'limit': datastring}, success: function(data) { $('#a').html(data); } }); } }); });
assume image size 100kb & app loads 4-5 images on every scroll. content comes mysql databse through php & "two.php" file contains data being fetched. limit
variable used set limit mysql query, i.e. how many rows returned.
Comments
Post a Comment