[jQuery] finding the exact error when using $.ajax
Hi,
I am using $.ajax method in an aspx page for the validation. When I
run this on my localhost, it works fine. however, when I deploy this
to our IIS server, it is not working. I am trying to get the error
message but not sure how to get it. could some one please help me?
Following is the code.
------------------
function ValidateRoutingNumber(event){
var txt = event.target;
if(txt != undefined){
if($.trim(txt.value).length > 0){
$.ajax({
type: "POST",
cache: false,
url: "<%= Request.ApplicationPath %>/Validations.aspx/
ValidateBankRouting",
data: "{'RoutingNumber':'" + txt.value + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
error: function(XMLHttpRequest, textStatus, errorThrown)
{
alert(errorThrown);
},
success: function(msg) {
var details = eval("(" + msg + ")");
if(details.Valid == true){
}
else {
//invalid
alert("Bank Routing number " + $(txt).val() + " is not
a valid Bank Routing number.");
$(txt).select();
}
}
});
}
}
}
-- function
<Runtime.Serialization.DataContract()> _
Private Structure BankRoutValidationResults
<Runtime.Serialization.DataMember()> _
Public Valid As Boolean
<Runtime.Serialization.DataMember()> _
Public BankName As String
<Runtime.Serialization.DataMember()> _
Public BankNameInDB As Boolean
End Structure
<WebMethod()> _
Public Shared Function ValidateBankRouting(ByVal RoutingNumber As
String) As String
Dim objResult As BankRoutValidationResults
Dim returnVal As String = String.Empty
Dim obj As BankRoutDAO
Try
objResult = New BankRoutValidationResults
If ValidateRoutingNo(RoutingNumber) = False Then
objResult.Valid = False
objResult.BankName = String.Empty
Else
objResult.Valid = True
obj = New BankRoutDAO(RoutingNumber)
If Not obj Is Nothing AndAlso obj.InDatabase Then
objResult.BankName = obj.Description.Trim
objResult.BankNameInDB = True
Else
objResult.BankNameInDB = False
objResult.BankName = String.Empty
HttpContext.Current.Session("BankRout") =
RoutingNumber
End If
End If
returnVal = JavaScriptConvert.SerializeObject(objResult)
Catch ex As Exception
LogException(ex.Source, ex.Message)
End Try
Return returnVal
End Function