Hi there,
This is probably unbelievably basic. In the code below, I have annotated the part that needs attention. I just do not know how to structure it if, instead of res.DATA.VALUE[i], I make it dynamic and write 'res.DATA.' + textCol + '[i]' (pure pseudocode, I realise it won't work)
function loadSelect(entity,textCol,retField,method) {
var thisid;
var thisval;
var textCol = textCol.toUpperCase();
$.getJSON("/cfcs/system.cfc?method=" + method + "&returnformat=json",{},function(res,code) {
if(res && res.ROWCOUNT > 0)
{
for(var i=0; i<res.ROWCOUNT; i++){
thisid = parseInt(res.DATA.RECORD_ID[i]);
thisval = res.DATA.VALUE[i]; //instead of VALUE, I want to use the textCol argument passed to this function.
..../snip