On twitter (new twitter) and facebook they now have the the ability to load new tweets and posts when you hit the bottom of the page..
Is there a JavaScript / jQuery event that you can call / add to a div so when the browser hits the bottom it does some ajax call to get the new data?
Thanks
Daniel
It uses readyState property of XMLHTTPRequest; readyState is simply an integer value which describes the status of HTTP request, whenever onreadystatechange function is called when readyState property changes.
A JSON object containing numeric HTTP codes and functions to be called when the response has the corresponding code. A callback function to be executed when Ajax request succeeds. A number value in milliseconds for the request timeout. A type of http request e.g. POST, PUT and GET.
The $.ajax() function returns the XMLHttpRequest object that it creates. Normally jQuery handles the creation of this object internally, but a custom function for manufacturing one can be specified using the xhr option.
There's a jQuery plugin for that: Infinite Scroll jQuery Plugin.
And here's the description of the pattern that it implements: The Interaction Design Pattern.
It's called Infinite Scrolling, and there's a jQuery plugin for it here: http://www.infinite-scroll.com/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With