gladstonesheeba
asked on
Pass an array to jquery function to build chart
Hi,
I have a Dictionary<string, int> variable users , which gets the data a total order count in this format
user1,0
user2,3
user3,6
...
..
Am building a chart from this data , so i need to transfer the data to a jquery function in this 2 kinds of format
First format
['user1',0],['user2',3],[' user3',6]
second format - for x axis
'user1','user2','user3'
Could you please help me how can i get those formats ?.
I have a Dictionary<string, int> variable users , which gets the data a total order count in this format
user1,0
user2,3
user3,6
...
..
Am building a chart from this data , so i need to transfer the data to a jquery function in this 2 kinds of format
First format
['user1',0],['user2',3],['
second format - for x axis
'user1','user2','user3'
Could you please help me how can i get those formats ?.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Once you have your JSON string in Jquery, you can use $.parseJSON() to convert it into an array. That's the first format you're requesting. The second format is a string by using .toString() on the array.
Here's a general idea of the Ajax code:
Open in new window
You method would look something like:
Open in new window