Access data from ajax success in complete?
<p>Is there a way that I can access the data I receive during success so i can use it during the complete callback?</p>

<p>Or perhaps there is a way where i can assign multiple success functions?</p>

<p>What i need is, to allow success callback to be changed based on situation, but I need to always perform a dedicated function on success using the same data that was returned to the first function.</p>

<p>I suppose i can always setup my call like so, but i'm looking to see if there is a better way.</p>

<pre><code>CallServer = function(options) {
  if(options.success) {
    var customSuccess = options.success;
    options.success = function(data) {
      defaultSuccess(data);
      customSuccess(data);
    }
  }
  $.extend(true, defaults, options);
  $.ajax(defaults);
}
</code></pre>

<p><strong>EDIT:</strong> I have found my answer. I didn't realize that the xhr holds the data as the responseText. so the following gets me the same thing that gets returned as 'data' on success.</p>

<pre><code>complete: function(xhr){dosomething(xhr.responseText);}
</code></pre>

<p>and that's it! Thanks</p>
