First you have to check whether your web service is configured to access using client side script. If not, it will raise the error message “500 – Internal server error”.
To call the webservice using client side scipt, web service should configure with [ScriptService] attribute.
For more details how to do this please check the following URL
http://tharakaweb.com/2013/01/01/web-service-and-script-service/[
^]
by changing the error function you can see the detail error response as follows
function OnError(data, status, error) {
alert(data.responseText);
}
see the error message, it is occurred due to the serialization issue. Please check Dictionary object and serialization
{"Message":"
Cannot convert object of type "System.String" to type "System.Collections.Generic.IDictionary`2[System.String,System.Object]","StackTrace":" at System.Web.Script.Serialization.ObjectConverter.ConvertObjectToTypeInternal(Object o, Type type, JavaScriptSerializer serializer, Boolean throwOnError, Object& convertedObject)\r\n at System.Web.Script.Serialization.ObjectConverter.ConvertObjectToTypeMain(Object o, Type type, JavaScriptSerializer serializer, Boolean throwOnError, Object& convertedObject)\r\n at System.Web.Script.Serialization.JavaScriptSerializer.Deserialize(JavaScriptSerializer serializer, String input, Type type, Int32 depthLimit)\r\n at System.Web.Script.Serialization.JavaScriptSerializer.Deserialize[T](String input)\r\n at System.Web.Script.Services.RestHandler.GetRawParamsFromPostRequest(HttpContext context, JavaScriptSerializer serializer)\r\n at System.Web.Script.Services.RestHandler.GetRawParams(WebServiceMethodData methodData, HttpContext context)\r\n at System.Web.Script.Services.RestHandler.ExecuteWebServiceCall(HttpContext context, WebServiceMethodData methodData)","ExceptionType":"System.InvalidOperationException"}