What if the condition is true, but the ajax call isn't a succes? This would not show. Try to add code for the error situation, like this:
$.ajax({
url: ...,
data: ...,
dataType: 'json',
type: 'POST',
timeout: 10000,
success: function(json){
},
error: function(jqXHR, textStatus, errorThrown){
}
});
Good luck!