1.) Convert the JSON string back to a javascript object in your javascript:
var jsObj = $.parseJSON(d); // using jquery method
2.) In your GetData method, your
dataLine1.data = "[[1356328800000,5],[1356933600000,3]]";
isn't going to work. That will make your data element a string in the JSON instead of a javascript array. It would be best to fix this in your WebMethod:
DataLines dataLine1 = new DataLines();
dataLine1.data = new List<int[]>();
dataLine1.data.Add(new int[] {1356328800000,5});
dataLine1.data.Add(new int[] {1356933600000,3});
That's totally untested (I've never used the JavaScriptSerializer
before, but similar code works with the ServiceStack serializer.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…