I have an $.ajax call that includes both a success and error condition:
$('input[name="StateName"]').live('change', function() {
var StateID = $(this).parents('tr').attr('id');
var StateName = $(this).val();
$.ajax({
url: 'Remote/State.cfc'
,type: "POST"
,data: {
'method': 'UpdateStateName'
,'StateID': StateID
,'StateName': StateName
}
,success: function(result){
if (isNaN(result)) {
$('#msg').text(result).addClass('err');
} else {
$('#' + result + ' input[name="StateName"]').addClass('changed');
};
}
,error: function(msg){
$('#msg').text('Connection error').addClass('err');
}
});
});
Q: Should I also wrap this in a try/catch?