thymeleaf url in js add value

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

thymeleaf url in js add value

marcpirat
 use spring boot and thymeleaf 3.

I have a fragment who have a form. There is a select when a value is choose, a change event is done and via ajax a fragment is loaded.

In fragment loaded by ajax, I have


$("#form").submit(function (e){
    $.ajax({
          type:"post",
          url: /*[[@{${url} }]]*/,
          data: $("#productsForm").serialize(),
          success: function(data){
          },
          error: function (XMLHttpRequest, textStatus, errorThrown) {
          }
    });
}

url come from spring mvc controller


url browser is: http://localhost:8080/menu/configurations

At the run time url value is template/edit/products/1


but when it submited, i get 404 error about

http://localhost:8080/menu/template/edit/products/1


why menu is added?


maybe because is nested with inline?