Ajax
call is made successfully. And I see a JSON
response. But some how the method fieldValidated
is not getting called when the message return is a success
.
Using Spring
in the back
JSON
response '{ "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);
}
});
}
Console.log
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