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?
Add this in your functions.php
Add this to your custom JS code
You can wrap javascript code in between php code like below