Ajax
调用成功。我看到了JSON
回应。但是fieldValidated
当消息返回是success
.
Spring
在后面使用
JSON
回复'{ "valid" : "false", "message" : "Some message" }'
function thisMethodIsCalledOnCursorOutFromInputField() {
$.ajax({
url: '${pageContext. request. contextPath}/X.htm',
data: {
someId: $('#someId').val()
},
contentType: "*/*",
dataType: "json", //Have also tried with "text"
success: function (data) {
console.log('response=', data);
fieldValidated("someId", data);
},
error: function (data) {
console.log('response=', data);
fieldValidated("emailId",data);
}
});
}
控制台日志
Uncaught SyntaxError: Unexpected token o jquery-1.10.1.js:550
x.extend.parseJSON jquery-1.10.1.js:550
$.ajax.error X.htm:115
c jquery-1.10.1.js:3074
p.fireWith jquery-1.10.1.js:3186
k jquery-1.10.1.js:8255
r