$.unblockUI is called no matter what - AJAX

$.unblockUI is called no matter what - AJAX

I have the following code:

  1. function login() { $.ajax({ url: 'login.php', type: 'POST', data: $('#loginNow').serializeArray(), error: function(data){ console.log(data); }, success: function(data){ console.log(data); setTimeout($.unblockUI, 1000); } }); };
My login-box looks like this:




If I just hit submit, the setTimeout($.unblockUI, 1000); in success is called, and the box disappears. I dont understand why. If I remove $.unblockUI, all the error/success-messages is printed out correctly.

I have also tried with just $.unblockUI. That works the opposite way. No matter what I type in, the box never closes, even if the printed text says: 'logged in'

Thanks!