I want to call this function in JavaScript:
http://codex.wordpress.org/Function_Reference/is_user_logged_in
But the examples are only with PHP. When that JavaScript function is called I want to check if the user is logged and send a message / redirect if not.
Is there a way to do this?