Skip to content Skip to sidebar Skip to footer

Referencing Php In Javascript

I am trying to call a php code which retrieves data from mysql table and populate it to an array and accessing it in the javascript. But screen shows nothing I know for sure there

Solution 1:

Seems you forgot to set include("db.php"); between php opening brackets.

<?php include("db.php");?> 

should do the trick


Solution 2:

Your include() command should be in <?php ... ?> tags, and with json_encode you don't need quotes around it (in fact using quotes will severely break your JavaScript). Correct these two errors and your code should work.


Post a Comment for "Referencing Php In Javascript"