0
My php is returning this data:
{"question":"Name","answer":"jorge","qt":"1","graph":"table"}
{"pergunta":"Name","answer":"Jorge","qt":"2","graph":"table"}
{"question":"Name","answer":"Jhon","qt":"1","graph":"table"}
{"question":"what is your favorite color ?","answer":"red","qt":"1","graph":"column"}
{"question":"what is your favorite color ?","answer":"blue","qt":"1","graph":"column"}
{"question":"what is your favorite color ?","answer":"yellow","qt":"1","graph":"column"}
{"question":"Are you over 20 years old?","answer":"No","qt":"1","graph":"pie"}
{"question":"Are you over 20 years old?","answer":"Yes","qt":"3","graph":"pie"}
This would be the return in jquery that I need to do dynamically because there will be times when I will have more questions than this example. So I need to group the same questions into objects because each object will feed a graph into canvas js.
{data : [{"question":"Are you over 20 years old?","answer":"No","qt":"1","graph":"pie"},
{"question":"Are you over 20 years old?","answer":"Yes","qt":"3","graph":"pie"}]}
{data :[{"question":"what is your favorite color ?","answer":"red","qt":"1","graph":"column"},
{"question":"what is your favorite color ?","answer":"blue","qt":"1","graph":"column"},
{"question":"what is your favorite color ?","answer":"yellow","qt":"1","graph":"column"}]}
{data :[{"question":"Name","answer":"jorge","qt":"1","graph":"table"},
{"question":"Name","answer":"Jorge","qt":"2","graph":"table"},
{"question":"Name","answer":"Jhon","qt":"1","graph":"table"}]}
Any idea how to do that? I appreciate the help!
Jonas, my friend, worked perfectly, very thankful!!!!
– Carlos Lopes