jquerywordpresssmoothstate.js

ajaxRequest.success is not a function with smoothState.js


I'm trying to implement smoothState.js into a custom WordPress theme but when i make a hover on my navigation, i can see this error :

Uncaught TypeError: ajaxRequest.success is not a function
fetch @ jquery.smoothState.js:352
hoverAnchor @ jquery.smoothState.js:539
dispatch @ jquery.min.js:3
q.handle @ jquery.min.js:3

It seems like ajaxRequest doesn't work (jquery.smoothState.js):

ajaxRequest.success(function (html) {
    utility.storePageIn(cache, settings.url, html, elementId);
    $container.data('smoothState').cache = cache;
});

So, when i click for change the page, I stay at the step "is-loading" class, someone can help me ?


Solution

  • You probably fetched the jQuery version 3.0 and as it says in the docs: http://api.jquery.com/jquery.ajax/

    Deprecation Notice: The jqXHR.success(), jqXHR.error(), and jqXHR.complete() callbacks are removed as of jQuery 3.0. You can use jqXHR.done(), jqXHR.fail(), and jqXHR.always() instead.

    If you go a version below you'll be safe!

    Cheers!