$.ajax does not call success callback but does call complete callback
I am using jQuery ajax to call an ASP.NET web service. The ajax calls succeed and return the correct value but the success callback is never called. However, the complete callback is called. Here is my ajax script:
$.ajax({
type: "POST",
url: "../UnsubscribeWebService.asmx/SubscribeToFewer",
data: "{'email':'" + email + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
dataFilter: function(data)
{
var msg;
if (typeof (JSON) !== 'undefined' && typeof (JSON.parse) === 'function') { msg = JSON.parse(data); }
else { msg = eval('(' + data + ')'); }
if (msg.hasOwnProperty('d')) { return msg.d; }
else { return msg; }
},
success: function(msg)
{
$("#result").text(msg);
},
fail: function(msg)
{
alert('fail');
},
complete: function(msg)
{
alert(msg.responseText);
}
});
Any assistance would be greatly appreciated.
Thanks,
Sean