I have coded like this:
$.ajax({ cache: false,
    url: "/Admin/Contents/GetData",
    data: { accountID: AccountID },
    success: function (data) {
        $('#CityID').html(data);
    },
    error: function (ajaxContext) {
        alert(ajaxContext.responseText)
    }
});
But when I look at the jQuery .ajax() documentation at the end it seems to suggest I should be coding like this below or at least it suggests adding a .done() and a .fail():
var request = $.ajax({ cache: false,
    url: "/Admin/Contents/GetData",
    data: { accountID: AccountID }
});
request.done(function (data) {
    xxx;
});
request.fail(function (jqXHR, textStatus) {
    xxx;
});
Update
If I code like this is it the same or is there some advantage to breaking it into three ?
$.ajax({ cache: false,
    url: "/Admin/Contents/GetData",
    data: { accountID: AccountID }
}).done(function (data) {
    xxx;
}).fail(function (jqXHR, textStatus) {
    xxx;
});
 
     
     
     
     
     
     
    