js/libs/ember-data.js
function(url, type, hash) {
    var adapter = this;

    return new Ember.RSVP.Promise(function(resolve, reject) {
      hash = adapter.ajaxOptions(url, type, hash);

      hash.success = function(json) {
        Ember.run(null, resolve, json);
      };

      hash.error = function(jqXHR, textStatus, errorThrown) {
        Ember.run(null, reject, adapter.ajaxError(jqXHR));
      };

      Ember.$.ajax(hash);
    }, "DS: RestAdapter#ajax " + type + " to " + url);
  }
function(url, type, hash) {
    var adapter = this;

    return new Ember.RSVP.Promise(function(resolve, reject) {
      hash = adapter.ajaxOptions(url, type, hash);

      hash.success = function(json) {
        Ember.run(null, resolve, json);
      };

      hash.error = function(jqXHR, textStatus, errorThrown) {
        Ember.run(null, reject, adapter.ajaxError(jqXHR));
      };

      Ember.$.ajax(hash);
    }, "DS: RestAdapter#ajax " + type + " to " + url);
  }
Takes a URL, an HTTP method and a hash of data, and makes an
HTTP request.

When the server responds with a payload, Ember Data will call into `extractSingle`
or `extractArray` (depending on whether the original query was for one record or
many records).

By default, `ajax` method has the following behavior:

It sets the response `dataType` to `"json"`
If the HTTP method is not `"GET"`, it sets the `Content-Type` to be
`application/json; charset=utf-8`
If the HTTP method is not `"GET"`, it stringifies the data passed in. The
data is the serialized record in the case of a save.
Registers success and failure handlers.

@method ajax
@private
@param {String} url
@param {String} type The request type GET, POST, PUT, DELETE ect.
@param {Object} hash
@return {Promise} promise