I want to draw a chart using Flot. The data is stored in my database (MongoDB) and Flot is being rendered in JS - so I need to somehow pass the data from my controller to Javascript in order to give this data to Flot. I tried to make a restful api with FosRestBundle, but when i tried to call it from the javascript on document.ready, i got the following error:
XMLHttpRequest cannot load localhost:8000/ajax/loginsperday.
Cross origin requests are only supported for protocol schemes:
http, data, chrome, chrome-extension, https, chrome-extension-resource.
What is the most efficient and proper way to draw a chart with Flot (JS) using the data from a database (MongoDB administered by Doctrine ODM)?