I am trying to run the following code:
I pass parameter to a function, but it always has the value of the last object run through the loop. I read some articles abou
Perhaps there's a problem with using parentId in the callback.
parentId
Try alert(parents[i]['PARENT_ID']);.
alert(parents[i]['PARENT_ID']);
EDIT: Let's see if we can get around our scope issues with .data().
aDisplayCol.data("parentId",parents[i]['PARENT_ID']); aDisplayCol.click(function() { alert($(this).data('parentId')); });