So current setup is as following:
PHP:data.php
You can use PHP to create the Javascript in the original page. json_encode() can be used to convert a PHP value to the analogous JS literal.
json_encode()