我写了个修改值的页面,每次到调试那,就直接绕过ajax,进入到行尾了,不进ajax,也不知道接口是对是错?
$.ajax({
type: "post",
url: "rls.php",
data: {
"Id" : "${roleId}",
"Name" : roleName,
"Code" : roleCode
},
dataType: 'json',
contentType: 'application/json;charset=utf-8',
success: function(data) {
console.log("success");
},
error: function(data) {
if (data.status == '200') {
alert('修改成功');
},
});
不进这里来,是什么原因
错误代码提示:
Unrecognized token 'Id': was expecting ('true', 'false' or 'null')
at [Source: org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream@9e3d60d; line: 1, column: 19]
从报错信息上看,我传的ID是布尔值,可是我的ID是字符串,怎么会是布尔值,跟做接口的哥们了解后,我的ID是布尔值,但是必须要转换成字符串才可以,所以下面的代码就转换了:然后就OK了
果然,自己挖坑,自己跳,再自己爬出来