I call a webservice that returns an array of objects:
$.ajax({
dataType: "json",
url: "WebServices/FetchMenu.aspx?P=0&L=2&mt=1",
//data: data,
success: function (data) {
var foo = data;
}
});
This is the response:
[
{
color: "red",
value: "#f00"
},
{
color: "green",
value: "#0f0"
},
{
color: "blue",
value: "#00f"
},
{
color: "cyan",
value: "#0ff"
}
]
I want add a property row_number
to each element which contains the current index of the element in the array.
I need this because I am changing the order of the elements later on but want to be able to identify the original position of an element.