If you read about this action here.
You will see that this hook provides access to two parameters, $user->user_login (string)
and $user ( WP_User
).
Using it like this you will see all the info you have access to:
function add_to_login($user_login, $user)
{
echo "<pre>".print_r($user, true)."</pre>";
}
add_action('wp_login', 'add_to_login', 10, 2);
But after a little testing I don’t see how you can use this info with your JS as the user is immediately redirected after this action. Your script won’t have time to do anything.