appendto/jquery-mockjax — pull request #93 by jameslafferty (2013-04-08 00:24:57+00:00)
Title: Async calls inside "response"

My use case looks something like this:

'use strict';

var _postLogin, _stubs;

_stubs = myApp.stubs;

_postLogin = $.mockjax({
type : 'post',
url : '/api/login',
response : function (settings) {
var _email, _passphrase, that;

_email = settings.data.email;
_passphrase = settings.data.passphrase;

that = this;

_stubs.db.login(_email, _passphrase, function (result) {

that.responseText = result;

});
}
});

_stubs.postLogin = _postLogin;