Hi, I’m trying to get data from a page’s collection into Javascript (for use with a data-visualization library). Is there any elegant way to do this ?
Right now I’m doing something like this :
Hi, what I need is to be able to get a page’s collection into a Javascript array of objects.
Say I have a page with a collection of blog posts. What I want is to be able to get into a JS script on this page an array of all the blog posts. It would look something like this :
[
{title: “Something”, date: “26-05-1968” …},
{…},
…
]
I though collections were PHP arrays so I tried to use json_encode(), but this returns an empty object.