Skip to content

Instantly share code, notes, and snippets.

@selvagsz
Forked from knownasilya/ajax.js
Created March 11, 2014 06:54
Show Gist options
  • Save selvagsz/9480789 to your computer and use it in GitHub Desktop.
Save selvagsz/9480789 to your computer and use it in GitHub Desktop.
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 (jqxhr, status, something) {
Ember.run(null, reject, arguments);
};
Ember.$.ajax(options);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment