Валидатор формы "удаленный" url-адрес не вызывает webmethod
I am facing issue for calling webmethod from remote validator in form validation.Please help me to resolve this issue. Please check my code: **
JQuery:
Что я уже пробовал:
txtUsername: { verbose: false, validators: { notEmpty: { message: '<%=Resources.LocalizedText.UserNameRequired%>' }, stringLength: { min: 6, max: 30, message: '<%=Resources.LocalizedText.UserNameAtleastSixChars%>.' }, regexp: { regexp: /^[a-zA-Z0-9_\.]+$/, message: '<%=Resources.LocalizedText.InvalidCharactersOnlylettersNumAndUnderscores%>' }, remote: { url: '/BackOfficeOperations/HMS/SimpleHMS.aspx.cs/checkUsername', type: 'POST', message: '<%=Resources.LocalizedText.UserNameAlreadyExists%>', delay: 1000 } } }
code
[WebMethod] public static void checkUsername(string txtUsername) { var tsvc = new TenantService(); if (tsvc.UserNameExists(txtUsername)) HttpContext.Current.Response.Write("{\"valid\": false}"); else HttpContext.Current.Response.Write("{\"valid\": true}"); }
HTML
<input class="form-control" name="txtUsername" />