I have a web app that runs several ajax calls . My faculty professor challenged me to create a generic message and unite the entire error handling in a single function. Can anybody help me ?
function getShoes() {
$.get( "/Shoes/List", function( data ) {
shoes = data;
}).fail(function() {
toastr.error('Erro ao buscar sapatos')
});
}
function getCoats() {
$.get( "/Coats/List", function( data ) {
coats = data;
}).fail(function() {
toastr.error('Erro ao buscar casacos')
});
}