pklauzinski / jscroll

An infinite scrolling plugin for jQuery.
http://jscroll.com/
1.11k stars 563 forks source link

Needs a user option to handle error from .load() #30

Open VictorySaber opened 10 years ago

VictorySaber commented 10 years ago

It should have a callback for when .load() (inside _load()) returns an error. Otherwise the loading image just sits there....forever.

At the moment I'm doing this (I should probably do a pull request or something but I'm still learning my way around GitHub):

$inner.find('div.jscroll-added').last().load(data.nextHref, function(r, status, xhr) { if (status === 'error') { // Let the user know there was an error loading the next set of content. $('.jscroll-loading').empty(); $('.jscroll-loading').html("There was an error retrieving the next set of data"); // Remove the loading image. return _destroy();

jtsternberg commented 9 years ago

Yep, this is definitely needed. it could be a callback or an event that gets triggered on the element.