ok, well i am not good with looping so here it goes..
i want to for loop this _.each
_.each(data, function (item) {
newData.push({
id: item.FormID, //id part present in data
text: item.FormName //string to be displayed
});
});
_.each is a function of underscore.js library.
i don't want to use the library, just the plain jquery or javascript.
i tried like this.. i know its wrong. but have tried and failed.
for ( var i = 0; i < data; i++ ) {
newData.push({
id: item.FormID, //id part present in data
text: item.FormName //string to be displayed
});
}
item.FormIDwithdata[i].FormID. Same forFormName, or create a variable calleditemand assign it withdata[i]before the push call in the loop