OK, then I think you could do something like have your javascript call the same page but add a parameter like "&forcelogin=1" or something like that. Then at the top of your script for that page (after global.php is included) put something like:
Code:
if ($_GET['forcelogin'] AND $vbulletin->userinfo['userid'] == 0)
{
print_no_permission();
}
I guess if you're using a forumblock then you're talking about the forum.php page? Then you can probably put the above code in a plugin using hook forumhome_start.