I have an array of C # that I need to show when I enter a certain page. I am making a request with AJAX to receive this data.
$.post({
url: '/Home/MostrarArray',
success: function (datas) {
console.log(datas);
}
});
These being my AJAX request and:
[HttpPost]
public string[] MostrarArray()
{
string[] matArray = new string[] { "uno", "dos", "tres", "cuatro" };
Array.Sort(matArray);
return matArray;
}
The function that I call.
What it returns to me (what console.log(datas)
shows) is a String , literally: System.String[]
I'm not sure how to get the array back and not the "type" of data ... Any idea what I'm doing wrong?