my question is as following:
- The project base url is : http://servername/sampelProjectName
- The test page url is :http://servername/sampelProjectName/user/home ,in this page I had include a javascript file - datatable.packer.js ,which i had included it using below code:
<script type="text/javascript" th:src="@{/resources/js/datatable.packer.js}"></script>
In the above datatable.packer.js file ,there's a ajax call ,the ajax call url is: "/api/test",like below definition:
var url="/api/test";
- then when i access the http://servername/sampelProjectName/user/home page ,the ajax call url parsed to : "http://servername/user/home/api/test " ,not the expected url "http://servername/sampelProjectName/api/test", and also if changed the url definition to "api/test" ,then it will parse to url : "http://servername/api/test" ...
any suggestion for this problem ? how to use the url in javascript code ? thanks very much for your help.