I am trying to get the value of a multidimensional int[][] array on JavaScript.
The array is initialized at the Controller class and passed to the JS through the View class in a Hidden input element called hdn_l_asuetos.
The problem is that I need to iterate over that int[][] array into de JavaScript file, but I cant.
Here my JS code:
var natDays = $('#hdn_l_asuetos').val();
function nationalDays(date, inMonth) {
if (inMonth) {
for (i = 0; i < natDays.length; i++) {
alert("MES " + natDays[i][0]);
alert("DIA " + natDays[i][1]);
if (date.getMonth() + 1 == natDays[i][0] &&
date.getDate() == natDays[i][1]) {
return {selectable: false};
}
}
}
return {};
}
I am getting this result:
MES S
DIA undefined
MES y
DIA undefined
MES s
DIA undefined
MES t
DIA undefined
MES e
DIA undefined
MES m
DIA undefined
MES .
DIA undefined
MES I
DIA undefined
MES n
DIA undefined
MES t
DIA undefined
MES 3
DIA undefined
MES 2
DIA undefined
MES [
DIA undefined
MES ]
DIA undefined
MES [
DIA undefined
MES ]
DIA undefined
With that I can see that var natDays = $('#hdn_l_asuetos').val(); is returning the Type of hdn_l_asuetos, System.Int32[][] at position 0.
I will appreciate any help to iterate over the int[][] array.
Thanks in advance.