added the login method for ajax call