This is my ASP.NET
code -
if (appointmentScheduledStartDate.HasValue)
{
var appointmentDate = appointmentScheduledStartDate.Value.Date.AddDays(1);
if(appointmentDate < currentDateAndTime)
{
throw new Exception("Link Expired");
}
}
And this is my jQuery.
function logChekInData(entityName, recordId, userId, lat, lon) {
x.innerHTML = "Please wait...";
$.ajax({
type: "POST",
dataType: "Json",
contentType: "application/json; charset=utf-8",
url: '@Url.Action("LogCheckIn", "InvestigatorCheckIn")',
data: JSON.stringify({
'entityName': entityName,
"recordId": recordId,
"userId": userId,
"lat": lat,
"lon": lon
}),
async: false,
success: function (data) {
x.innerHTML = "Successfully tracked your location.";
},
error: function (xhr) {
x.innerHTML = xhr.responseText.Message;
//x.innerHTML = "Error occured. Please try later.";
//alert(xhr.responseText);
}
});
}
Let me know how can I get the exception message via jQuery.ajax? I'm getting undefined
message every time. How can I solve this ?