I've the following code:
getTrainPlanDetail: function(id){
var df = new $.Deferred();
$.post( config.api, addJSONHeaders("detail_fiche_entrainement",{"idRequete": id}), function(data){
if (ajaxEval(data)){
df.resolve(data);
} else {
df.fail(data);
}
}, 'json').fail(function(jqXHR, textStatus, errorThrown){
df.fail();
});
return df.promise();
},
after minification it gets converted into:
getTrainPlanDetail: function(a) {
var b = new $.Deferred;
return $.post(config.api, addJSONHeaders("detail_fiche_entrainement", {idRequete: a}), function(a) {
ajaxEval(a) ? b.resolve(a) : b.fail(a)
}, "json").fail(function() {
b.fail()
}), b.promise()
}
Do you notice the problem with the return? I want to return the b.promise(); not the $.post Can someone tell me why is this happening? To me it doesn't make sense.