JQuery not working after null ajax responce <p>I have Jquery code</p> <pre><code>$(document).ready(function(){ $('#login').click( function () { $.post('/profile/ajax/login', { username: $('#username').val(), password: $('#password').val(), }, function (res) { if (res != null) { $.each(res, function (i, val) { $('#login-error').html('&lt;div class="alert alert-danger fade in"&gt;&lt;a class="close" data-dismiss="alert" href="#"&gt;×&lt;/a&gt;' + val + '!&lt;/div&gt;'); return false; }); } else { location.reload(); } }, 'json' ); } ); } </code></pre> <p>And have PHP code</p> <pre><code>if($_POST) { $username = $_POST['username']; $password = $_POST['password']; $post = Validation::factory($_POST); $post-&gt;rule('username', 'not_empty'); $post-&gt;rule('password', 'not_empty'); if($post-&gt;check()) { if(!Auth::instance()-&gt;login($username, $password, true)) { echo json_encode(array('Неверный Логин или Пароль')); } } else { $errors = $post-&gt;errors('validation'); echo json_encode($errors); } } </code></pre> <p>If Ajax return some text with errors (res != null) - Jquery work normally. If Ajax returned without any information nothing happens in "else" block.</p> <p>How I can solve this problem?</p>