how to use php in a javascript file in elgg?

while loading and using a javascript file i am seeing a browser console error:

Cache error: bad request

i see this message on line 50 here:
though i am no closer to finding the cause of this error.

the javascript file i am loading contains some php too and has a name with a .php ending.

this approach has been used succesfully in the extended_tinymce plugin. the javascript is loaded with the following code in my start.php file:

elgg_register_js('elgg.my_code', elgg_get_simplecache_url('js', 'my_code'));

when i run the page without simplecache enabled i see no errors.. any idea what i am missing here?

(i have already cleared the browser cache and data etc.)