$(function () {
$('input#UserName').blur(function () {
var username = $('input#UserName').val();
$.ajax(
{
type: "POST",
url: "Profile/CheckAvailability",
data: "username=" + username,
success: function (result) {
//Some code here
},
error: function () {
alert("Sorry! We could not receive your feedback at this time.");
}
});
});
});
и код на контроллере профиля
[HttpPost]
public JsonResult CheckAvailability(string username)
{
bool isAvailable = false;
//Some code here
return Json(new {success = isAvailable});
}
Каждый раз, когда срабатывает alert("Sorry! We could not receive your feedback at this time.");
.
Спасибо.