I'm having a javascript issue that's driving me completely insane. I have a collection of data that I'm iterating over using the jQuery .each() method. Inside the .each() callback function, I'm pushing data on the an array. Here's the code.
var p = procedure_tool.all();
previousValue = -1;
var proceduresArray = [];
p.each(function(d, proceduresArray) {
proceduresArray.push(d.procedureID);
});
I've also tried making the proceduresArray global (no var in front), and then trying not to pass it through the anonymous function.
var p = procedure_tool.all();
previousValue = -1;
proceduresArray = [];
p.each(function(d) {
proceduresArray.push(d.procedureID);
})
The data does exist (alerts inside the callback display it fine). Any ideas? I feel like it's a scope issue, but I figure that globalizing the array would have fixed it.
Thanks