Replace deprecated jquery method

According to the [jQuery documentation](http://api.jquery.com/deferred.pipe/), the `deferred.pipe` method is deprecated. One should use `deferred.then` instead.