1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
| publics.getOppors = function (bpcnum, bpaadd, tsccod, tsccod1, tsccod2, rep, datedeb, datefin) {
$.ajax({
url: privates.url,
cache: false,
type: "GET",
dataType: "json",
data: {
a: 'getoppors',
bpcnum: bpcnum,
bpaadd: bpaadd,
tsccod: tsccod,
tsccod1: tsccod1,
tsccod2: tsccod2,
rep: rep,
datedeb: datedeb,
datefin: datefin,
j:1
},
success: function(data) {
$.each(data, function (key, value) {
var oppornum = data[key]['oppor'];
var html = '<tr>';
if(data[key]['oppor'] == '') {
html = html + '<td class="colhead nowrap" colspan="2">Hors codes promos</td>';
} else {
var oppor = publics.getOppor(oppornum);
console.log('oppo : ' + oppor);
// oppor est toujours undefined alors qu'il y a bien un résultat :(
html = html + '<td class="colhead nowrap" colspan="2"><i>' + oppornum + '</i> - ' + oppor + '</td>';
}
html = html + '</tr>';
console.log(html);
});
},
error: function(){
console.log('no data');
}
});
}
publics.getOppor = function (oppor) {
$.ajax({
url: privates.url,
cache: false,
type: "GET",
dataType: "json",
data: {
a: 'getoppor',
oppor: oppor,
j: 1
},
success: function(data) {
return(data);
},
error: function() {
console.log('pas d oppor');
}
}); |
Partager