Spring:url 標籤賦值給js變數
阿新 • • 發佈:2019-01-27
$("#deleteSingleUser").click(function (e) { e.preventDefault(); var id = $("#userId").val(); <spring:url value="/robbie/deleteSingleUser/" htmlEscape="true" javaScriptEscape="true" var="urltemp"/>; var deleteUrl = "${urltemp}"; var url = deleteUrl + id; alert(url); $.get(url,function (data) { $("#searchResults").text(data); }) return false; });
var deleteUrl = "${urltemp}";
這行一定要加引號!