Push [getJSON] values into a local varialbe array - MVC4
Hi All,
How to we get Json values to a local variable array?
My Json Get function:
var dataArray = [];
$.getJSON("/Role/GetSeasonsRatesJson", function (myData) {
$.each(myData, function (i, item) {
dataArray.push([item.FromDate, item.ColorValue]);
});
}
Will return following value pairs:
var _myData = new[] {
new { FromDate = "01122013", ColorValue = "Red" },
new { FromDate = "02122013", ColorValue = "Red" } };
Not able to access the values in local variable
dataArray
.
Thanks,
Saran