First of all you can not call javascript from controller. Javascript runs on client side, your controller is running on the server.
Although you can make the view execute code on behalf of the server.
If speaking from validation in general, you can do client and server side validation in MVC3, or you can (should) use both. If you use server side validation, the page is posted, thus refreshed. If you use client side one, you need to send the logic on client side. Validating credentials is not really possible this way - and this is called authentication, not validation.
If I understand your post correctly, you want authentication to look and feel like client side validation. Than you need
remote validation[
^].