今天想要用Ajax把一个对象传回后台
于是出现了下面这段代码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
$(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内置的域对象


再次更新,在js中添加request域中的内容是可行的