AJAX call ending in error with Status 200 / OK - why?
ASP.NET 4.0
jQuery 1.4
While all seems well in my request and response I get tossed into the error callback rather than the success. I use Firebug to check the repsonse and it's:
{"d":"Hello"}
Client code:
function GetStateCertifiable() {
var AreaID = $("#listAllAreas").val();
$.ajax({
url: "../WebServices/AoP.asmx/GetStateCertifiable",
data: '{"AreaID":"' + AreaID + '"}',
type: "POST",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (msg) {
alert("Success");
},
error: function (result) {
alert("An error occured. \nStatus: " + result.status
+ "\nStatus Text: " + result.statusText
+ "\nError Result: " + result);
},
complete: function () {
}
});
Server code:
[System.Web.Script.Services.ScriptService]
public class AoP : System.Web.Services.WebService
{
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public string GetStateCertifiable(string AreaID)
{
return "Hello";
}
}
My error debugging returns the following:
Status: 200
Status Text: OK
Error Result: [object XMLHttpRequest]
I can do my thing in the Completed callback but that's a total kludge. I can't understand why I keep ending in error with no apparent error code and a response of well formed JSON. Any ideas?
Thanks,
BK