I am calling a MSFT-MVC action using jQuery $.ajax()
public bool SetActivePatient(string patientID)
{
which returns a boolean.
The $.ajax() call is always firing the error option.
$.ajax({
type: 'POST',
url: '/Services/SetActivePatient',
data: { 'patientID': id },
dataType: 'text',
success: function(returnVal) {
if (returnVal == "True") {
...
}
else {
alert('Error setting active patient return value, PatientID=' + id);
}
},
error: function() {
alert('Error in ajax call');
}
});
The MVC action is called and works correctly, returning "True" as a .NET bool. Looking in FireBug the response is "True" from the MVC action. Do I have the wrong dataType?