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 moments that I will have more questions than this example. So I need to group the same questions into objects because each object would feed a graphic 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 ideas how to do this? Thanks for the help!