I want to add some PHP into JavaScript, however, the one I have at the moment does not work and was wondering if you could help.
This is what I have so far:
$(document).ready( function() {
 setTimeout( function() {
  $("body").addClass("ready");
 }, 1700);
 setTimeout( function() {
  $(".splash h1").html("Hi <?php echo '$first_name'?>");
  setTimeout( function() {
   $(".splash h1").html("Welcome to your Profile");
  }, 1500);
 }, 900);
});
The variable first_name is already defined and fully working on the PHP page it will display on.
Here is the PHP code
    <?php
/* Displays user information and some useful messages */
session_start();
// Check if user is logged in using the session variable
if ( $_SESSION['logged_in'] != 1 ) {
  $_SESSION['message'] ='<br>You must be logged in before accessing that page!';
  header("location: login.php");
}
else {
  $title = $_SESSION['title'];
  $first_name = $_SESSION['first_name'];
  $last_name = $_SESSION['last_name'];
  $email = $_SESSION['email'];
  $school_name = $_SESSION['school_name'];
  $class = $_SESSION['class'];
  $school_admin = $_SESSION['school_admin'];
  $position = $_SESSION['position'];
  $active = $_SESSION['active'];
  $staff = $_SESSION['staff'];
  $grav_hash = md5("$email");
}
?>
 
     
     
    