Ajay Patel

Ajay Patel

  • NA
  • 147
  • 251.7k

Call webservice using JQuery reflect 404 error

Apr 22 2014 3:13 AM
Hello,
 
I am facing a strange problem. I have webservice that is running pretty good on its url. I am consuming it using jQuery and all methods are working fine but one method throw error of 404 with readystate 4.  I have checked the url and it is correct. I don't know why this is happening.
 
 This is my Code :
 
$.ajax({
type: 'POST',
cache: false,
url: "http://ajayp/WebService2.8/XYZasmx/GetXYZ",
contentType: 'application/json; charset=utf-8',
data: "{ReportID: '" + RptNR + "'}",
dataType: 'json',
success: function (e) {
if (e.d != null) {
SetFields(JSON.parse(e.d));
}
else {
alert("Invalid Case Number");
}
},
error: function (e) {
alert(e.responseJSON);
},
fail: function (e) {
debugger;
}
});
 
 
My VB Code :
 
<WebMethod()> _
<System.Web.Script.Services.ScriptMethod(ResponseFormat:=System.Web.Script.Services.ResponseFormat.Json)>
Public Function GetRacialProfilingDataByReportID(ByVal ReportID As String) As String
Try
Return "Ajay Patel"
Catch ex As Exception
Throw ex
End Try
End Function
 

Answers (2)