I've seen things like this in many projects. Server generates html page with <script>
tag, and JS code in it, which defines some constants, using templates.
For example.
<script>
window.USER_ID = "<%= getUserId() %>";
window.BASE_PATH = "<%= server.basePath %>";
</script>
Is this considered bad practice? If so, what's good way to pass server constants to client?
Aucun commentaire:
Enregistrer un commentaire