Skip to content

Instantly share code, notes, and snippets.

@knownasilya
Last active June 22, 2016 14:37
Show Gist options
  • Save knownasilya/9472916 to your computer and use it in GitHub Desktop.
Save knownasilya/9472916 to your computer and use it in GitHub Desktop.
RSVP jquery ajax wrapper
function ajax(url, options) {
return new Ember.RSVP.Promise(function (resolve, reject) {
options = options || {};
options.url = url;
options.success = function (data) {
Ember.run(null, resolve, data);
};
options.error = function () {
Ember.run(null, reject, arguments);
};
Ember.$.ajax(options);
});
}
@vvscode
Copy link

vvscode commented May 17, 2016

@knownasilya what for used run ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment