I want to use a PHP variable as a javascript variable - specifically I want to user the PHP variable session_id(); and use this as a javascript variable.
That's just fine. Be sure that if the variable you're echoing is a string that you put quotes around it and escape any quotes, newlines, etc. inside it -- e.g., make sure it really gets output as a valid JavaScript string literal. Also, don't forget the var before js_var.