Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Ajax, JSON and googlecharts..oh MY!
Message
From
08/07/2014 17:20:55
 
 
To
All
General information
Forum:
Javascript
Category:
JQuery
Title:
Ajax, JSON and googlecharts..oh MY!
Miscellaneous
Thread ID:
01603355
Message ID:
01603355
Views:
63
Has anyone messed with GoogleCharts and Ajax?

I've got a stored proc (SQL 2008 R2) that I'm calling via Ajax
            var AjaxData = $.ajax({
                type: "POST",
                contentType: "application/json;",    
                url: "WebForm1.aspx/GetHeartBeatData",
                data: "{}",
                dataType: "string",
                async: false
            }).responseText;
            var MyArray = eval("[" + AjaxData + "]");
The call to the Stored Proc is returning the data as a string, just like I expect it to be.

The last line should be making an array of the string of data that's coming back. Said data is "Object, (Array)"
When I look at the MyArray[0] element I see a _proto_ element and a "d" element which actually contains my data.
Name                   Value                      Type

MyArray         [[object Object]]      Object, (Array)
   [0]                {...}                 Object
      _proto_         {...}                 Object
      d              "[Time","DB1"]....     String
Then I issue the call for googlechart data acquisition:
 var data = google.visualization.arrayToDataTable(MyArray[0]);
I get "Not an array" - what the huh?
"You don't manage people. You manage things - people you lead" Adm. Grace Hopper
Pflugerville, between a Rock and a Weird Place
Next
Reply
Map
View

Click here to load this message in the networking platform