How to convert the object { CntDay: 0, CntMonth: 2, CntYear: 4 }
to the array [ 0, 2, 4 ]
?
I am getting my data in the events
array but I need the array to not form like { CntDay: 0, CntMonth: 2, CntYear: 4 }
but simply like [ 0, 2, 4 ]
.
function createChartWinLoss() {
var events = [];
$.ajax({
type: "POST",
dataType: "json",
contentType: "application/json; charset=utf-8",
url: "Dashboard.aspx/NewChart",
success: function(data) {
$.each(data.d, function(i, v) {
events.push({
CntDay: v.CntDay,
CntMonth: v.CntMonth,
CntYear: v.CntYear
});
})
ChartProp(events)
}
});
}
function ChartProp(events) {
var a = $.map(events, function(value, index) {
return [value];
});
}