Added test code

With this condition, you ensure that only if the variable is true the code beneath it will be added to the HTML. That way you can add javascript anyway you want to. This works good when embedding small javascript codes into the application. If you need more complicated stuff, it's better to just make ajax calls to the server and get a json response in a separate .js file to keep it cleaner.