defunkt / jquery-pjax

pushState + ajax = pjax
https://pjax.herokuapp.com
MIT License
16.73k stars 1.97k forks source link

Fallback pjax should return a then-able object #679

Open westoque-gv opened 7 years ago

westoque-gv commented 7 years ago

Currenty, if you have pjax disabled, it uses the fallbackPjax function and you have code that relies on Promises like this:

$.pjax({
  url: '/'
}).then(function() {
  // .. do something
});

This code above will break with TypeError: undefined is not an object (evaluating '$.pjax({ url: '/' }).then') due to $.pjax not returning a then-able object.