title: Implementing custom ajax calls when loading data in model
body: <p>In my Emberjs application I have an Employee model which I should load through a REST Get API call, where I have to authenticate the API first for a token then start loading the data, I know how to do this easily using JQuery but not sure how I can implement this in EmberJS, so I will appreciate it so much if anyone can instruct me how to do so.</p>
  
  <p>Below is the JQuery code I use for authentication, extracting the employees data, as well as my EmberJS model code</p>
  
  <p>Thanks</p>
  
  <p>Authentication:</p>
  
  <blockquote>
  <pre><code> $.ajax
    ({
      type: "POST",
      url: "http://portal.domainname.com/auth",
      dataType: 'json',
      async: false,
      data: JSON.stringify({ 
          Login: "logmein@email.com", 
          Password : "test"
      }),
      success: function(data) {
          console.log(data); //Here I get the token needed for further calls...
      },
      error: function(xhr, error){
          console.debug(xhr); console.debug(error);
      } 
  });
  </code></pre>
  </blockquote>
  
  <p>Calls to load employees data:</p>
  
  <blockquote>
  <pre><code>$.ajax   ({
      type: "GET",
      url: "http://portal.domainname.com/employees",
      dataType: 'json',
      async: false,
      beforeSend: function (xhr) {
          xhr.setRequestHeader ("Token", "0000000-0000-0000-0000-00000000");
      },
      success: function(data) {
          console.log(data);
      },
      error: function(xhr, error){
          console.debug(xhr); console.debug(error);
      }  });
  </code></pre>
  </blockquote>
  
  <p>EmberJS Model</p>
  
  <pre><code>App.Store = DS.Store.extend({
    revision: 11
  });
  
  App.Employee = DS.Model.extend({
    employeeID:             DS.attr('string'),
    employeeName:        DS.attr('string')
  });
  
  App.Store.reopen({
   adapter: 'DS.RESTAdapter'
  });
  </code></pre>