ajax - How to turn jQuery $.get into Bluebird thenable? -


i want get jquery , thenable it's result then never happening; why? of course json response back. below full code:

var promise = require('bluebird');  new promise(function (resolve, reject) {     return $.get(url.address, url.options, 'json'); }).then(function (result) {     console.log(result); }); 

use promise.resolve, converts value or thenable library (like return value of $.get bluebird promise.

promise.resolve($.get(...)) // converts bluebird promise 

your example code wrong - promise constructor ignores return values - in upcoming version of bluebird warning.


Comments