Send variables between PHP and Javascript

I’m building an admin panel for my site and i need a login panel.

I don;t think this is the smartest way to go aboutit, but I’m using both javascript and PHP to build it. The Javascript builds the input boxes and checks the user and pass and then the php takes wether its a correct login and loads the correct info.

I’ve tested the two seperately and know they are fuctional, but putting them together is a pain. I had it working, but I had to echo the login variables, making them visbile in he code.

I want to be able to send a variable to the javascript without having it visible in the source.

Any ideas?