I'm having some issues with returning a value from a synchronous ajax call. The value I want to return is a class I created for a server response.
Here's the AJAX code:
function webRequest(file, data) {
    return $.ajax({
        url: "http://xxx.xx.xx.xxxx/xxxxx/"+file,
        type: "POST",
        data: data,
        asynch: false,
        error: function(jqXHR, textStatus, errorThrown){
            return new ServerResponse(false, errorThrown);
        },
        success: function(data, textStatus,  jqXHR){
            return new ServerResponse(true, data);
        },
        timeout: 7500
    });    
}
Here's ServerResponse.js
var success = false;
var text = null;
var ServerResponse = function(success, text) {
    this.success = success;
    this.text = text || null;
};
ServerResponse.prototype.isSuccessful = function() {
    return this.success;  
};
ServerResponse.prototype.getData = function() {
    return this.text;
};
The returned value of webRequest(..) is as follows:
Object {readyState: 1, getResponseHeader: function, getAllResponseHeaders: function, setRequestHeader: function, overrideMimeType: function…}abort: function ( statusText ) {always: function () {complete: function () {done: function () {error: function () {fail: function () {getAllResponseHeaders: function () {getResponseHeader: function ( key ) {overrideMimeType: function ( type ) {pipe: function ( /* fnDone, fnFail, fnProgress */ ) {progress: function () {promise: function ( obj ) {readyState: 0responseText: ""setRequestHeader: function ( name, value ) {state: function () {status: 0statusCode: function ( map ) {statusText: "error"success: function () {then: function ( /* fnDone, fnFail, fnProgress */ ) {__proto__: Object VM2324 controllers.js:48
How can I return the ServerResponse instance created from within the ajax call? 
 
    