今天想要用Ajax把一個對象傳回後臺
於是出現了下面這段代碼
$(function () {
let requestBody = JSON.stringify(${sessionScope.loginUser});
$("#sendAnchor").click(function () {
$.ajax({
"url": "user?method=resendEmail",
"type": "post",
"dataType": "json",
// "contentType": "application/json; charset=UTF-8",
"data": {
requestBody: requestBody
},
"success": function (response) {
prompt_frm(response);
},
"error": function (response) {
prompt_frm(response.status + " " + response.statusText);
}
});
return false;
});
});
然後JS代碼就不管用了
查了好久終於明白了,在Js中不可以加jsp內置的域對象