This tutorial presents a way of separating JS code from views and passing to it values from PHP.
this is my way for embed js code block in view file: