Cannot cancel Invoice

when trying to cancel sales invoice, after clicking the yes button no action is performed and this is error is thrown up on the console of the browser.

Solved it.!

Replaced done(function(){... with then(function(){...