I have a loading gif for the gallery on my website. In my js file I have this code to show the loader:
image: $(\"
\"),
You can't place PHP code directly into a .js file, but you could have some javascript in the head element of your PHP file right before including the javascript file.
In this javascript you could then define variables and assign data to them using PHP. These variables would then be accessible from inside the javascript file.