I am having troubles getting a return string passed back to the validator.
Here is my js
$('#frmSignUp').validator({
custom: {
emailexist: function ($el) {
var result = checkUserEmail($el.val())
.done(function (r) {
if (!r.success) {
// email already in use
return r;
}
})
return result.responseText;
}
}
});
function checkUserEmail(name) {
return $.ajax({
url: '@Url.Action("CheckUserName","Account")',
data: { ChapterPOCEmail: name },
type: 'POST',
dataType: 'json'
});
}
in chrome dev tools the "r" does indeed have the full json returned from the controller
{"success":false,"responseText":"That email is already in use."}
However, the validator isn't receiving the string, and therefor is still showing the green check mark in the feedback, and no message in the help-block. I have tried to use the "data-remote", but I couldn't get asp.net to return a status code along with a message correctly. it was overriding any custom message I sent back , and the validator couldn't receive it.
Any help on my issue would be appreciated.