"can u try this var jsvariable = <?php = "hello" ?> in place of hello u can display ur database element make sure this script u have written in top of the body"