I have situation where I want to output two table columns from my query in array. Ideally I would like to output one ID_1 then second ID_2 and after I store all ID's in array I want to loop through that array to check if ID_1 is greater than 0 and if it is I would like to use matching ID_2 to hide element. Here is my code that i have so far:
var records = [];
~[tlist_sql;
SELECT ID_1, ID_2
FROM SLOTS
]
records.push("~(ID_1)","~(ID_2)");
[/tlist_sql]
for(var i=0; i< records.length; i++){
//if ID_2 is greater than 0
if(records[i].idTwo > 0){
var test = ('#row_' + records[i].idOne).val();
alert(test)
//here I want to use ID_1 to hide row
$j('#row_' + records[i].idOne).parent('.hideElement').hide();
$j('#button1').hide();
}
}
Here is how my array records looks like:
[-1,2050,-1,2046,15,2048,0,2044,10,2051,0,2047]
So as you can see in this array only two records will pass if statement where ID_1 is 15,10 and ID_2 is 2048,2051. My current code doesn't use correct values looks like id's are split some how. Does anyone know how I should look for ID_1 and then for ID_2 and is array the best to use in this case? Thank you.
[ID_1, ID_2, ID_1, ID_2]?