Solution:1
Jquery is javascript was executed by browser.
Set the header as javascript on your php and load with script tag.
<script type="text/javascript" src="/yourphpfile.php"></script
And then in fileĀ yourphpfile.php
<?php
header('Content-type:application/javascript');
$stringFromDb = functionGetContentFromDB();
?>
var data = "<?= $stringFromDb ?>";