Make front-end js more dynamic with backend variables