I have to loop in few data from server and export to csv file. While exporting I am getting the data in reverse order.
In the below code the index is starting from the first element and pushing the data. Is there a way wherein I can loop the data from the last element. Index should start from last element and come to first
Code:
$.each(exportArray, function (index, value)
{
csvData.push(ProcurementRelatedUID[index] + "," + ProcurementPurchaseId[index] + "," + ProcurementVendorName[index] + "," + ProcurementPlant[index] + ","+ ProcurementPlannedDeliveryTime[index] + "," + ProcurementStorage[index] + "," + ProcurementInHouseProductionTime[index] + "," + ProcurementGRProcessing[index]);
});
csvData = 'data:application/csv;charset=utf-8,' + encodeURIComponent(output);
$(this)
.attr({
'download': filename,
'href': csvData,
'target': '_blank'
});