title: Add .done() callback to custom function
body: <p>I've these functions included in a small class:  </p>
  
  <pre><code>var Ajax = {
    // Send new entry data to database
    endNewEntry: function (json) {
      $.post("/controllers/insertEntry.ajax.php", {"json": json});
    },
    loadView: function (view, target, extra) {
      var input = $.extend({}, {"view": "../" + view}, extra) || {"view": "../" + view};
  
      $.get("/controllers/loadView.ajax.php", input, function (data) {
        $(target).replaceWith(data);
      });
    }
  };
  </code></pre>
  
  <p>As you can see, both functions use jQuery <code>$.ajax</code> to perform requests to my server and replace part of my document with the response.</p>
  
  <p>Now I'd like to add a feature to these functions to let me call another function (callback) when the post request is finished.</p>
  
  <p>I'd like this syntax:</p>
  
  <pre><code>Ajax.loadView(view, target, extra).done( function() { something; });
  </code></pre>
  
  <p>The only way I know, instead, is to add another parameter to <code>loadView</code> where my callback function is defined, but I would like to have the <code>.done()</code> function.</p>
  
  <p>How can I do?</p>