Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Uncaught TypeError: Object #<Object> has no method 'success' #12

Closed
tomascassidy opened this Issue Jan 29, 2013 · 3 comments

Comments

Projects
None yet
5 participants

When I try to use this with jQuery 1.8.3, I get the following error:

Uncaught TypeError: Object # has no method 'success'

The error is thrown on https://github.com/paulirish/jquery-ajax-localstorage-cache/blob/master/jquery-ajax-localstorage-cache.js#L31

Nevon commented Feb 19, 2013

I'm guessing you're invoking it like:

$.ajax({
    url: url,
    dataType: 'json',
    localCache: true,
}).done(function(data) {
    //Success callback
});

This plugin seems to assume that you're using the old-style success callback. I've spent a few hours today trying to convert it over to using deferred callbacks (.done, .fail, etc.) with little success. This is what I've got so far. The big problem is that the done callback is never run due to the abort method call. I quite frankly have no idea how to solve it, as I am pretty crappy at jQuery, but I'm hoping someone else will know.

This is also related to #13

@Nevon You can call the done method by doing return jqXHR.done(value)

kayzee commented Jan 21, 2015

@th3fallen the cache function doesn't work with this solution because it still performs the AJAX call unless you call jqXHR.abort();

@SaneMethod SaneMethod closed this Jun 9, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment