I have a simple C # function that returns an array like this:
protected int[] numArray()
{
int [] hi = {1,2};
return hi;
}
I am trying to get these values ββin my javascript, so I am trying to do this in asp.net:
var array = '<%=numArray()%>';
window.alert(array[0]);
window.alert(array[1]);
However, instead of passing the array back, it seems to pass the string ("System.Int32 []"). The first warning prints "S", and the second prints "y". How can I print my numbers. Should I return a string from my C # code?
source
share