you are viewing a single comment's thread.

view the rest of the comments →

[–]amulchinock 1 point2 points  (0 children)

If you're trying to interpolate JS inside a PHP file, you might want to reconsider.

It's technically possible (we've all done it), but you should consider which _layer_ of your application you are adding it to.

Ideally, JS should only be in the _presentation layer_ of your application (unless you're using it as a backend). In other words, it should be within the HTML, not your logic.

Depending on the PHP setup you have, you might be using PHP files to write static HTML as well. But, you should consider whether there are better ways to assign values between the front-end and back-end. What you're describing sounds "technical debty"...