To access PHP values and variables from Javascript using Drupal, you can send them to your javascript code using Drupal's drupal_add_js as follows:
drupal_add_js(array('mymodule' => array(
'username' => 'Mike',
'uid' => 123,
'likes' => array('ice cream', 'peanuts', 'coffee'),
)), 'setting');
Then in Javascript, you can use your variables which will appear inside Drupal.settings:
alert(Drupal.settings.mymodule.username);
