jQuery Ajax function does not respond when Node server crushes

I have a problem with a jQuery Ajax request that does not respond when my NodeJS server crushes.

function postRequest(url, query, onComplete) {

    $.post(url, query)

    .done(function (response) {
        onComplete(false, response);
    })

    .fail(function (xhr) {
        onComplete(true, xhr.status);
    }); 
}

postRequest('/noderoute', {id: 4}, function (error, res) {
    if (!error) {
        $('#content').html(res);
    }
    else {
        alert(res);
    }
});

If the server responds, all is good and well but if it crushes nothing happens. How can I solve this? Thank you.

Edit: Solved

I have been running my tests on a production build instead of my development files. Everything working fine now.

You are passing an incorrect xhr argument to your fail call.

.fail(xhr, function () {

should be

.fail(function (xhr) {