0

I started to work with JAVA Spring recently as operator for server-side. I have doT.js template laying on the server, so when clicking on navigation bar button - I need to fetch somehow this template and after rendering it with javascript - append it to page container. Should I have special JAVA controller for this purpose or AJAX request can somehow fetch it from server without special controller?

Dancyg
  • 139
  • 1
  • 15

1 Answers1

0

Problem was solved without special JAVA controller - directory "resources" can be accessed with AJAX directly (with specifying full path). I fetched doT template as simple html file.

$.get('resource/templates/template.html')
        .then(function(body) {

        $(".element").html(body);

        var elementTemplate = doT.template($('#elementAnother').text());

        $('#elementAnotherAnother').html(elementTemplate({}));

        render();
    });
Dancyg
  • 139
  • 1
  • 15