[英]Symfony2 - how to properly access data from the DB (via controller) in JS in order to use Flot?
I want to draw a chart using Flot. 我想使用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.
数据存储在我的数据库(MongoDB)中,并且Flot正在JS中呈现-因此,我需要以某种方式将数据从控制器传递到Javascript,以便将数据提供给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:
我试图使用FosRestBundle创建一个宁静的api,但是当我尝试从document.ready上的javascript调用它时,出现以下错误:
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)? 使用数据库中的数据(由Doctrine ODM管理的MongoDB),用Flot(JS)绘制图表的最有效,最正确的方法是什么?
you can : 您可以 :
Don't forget to hide element DOM technical for just render a JS plugins 不要忘记隐藏仅用于呈现JS插件的元素DOM技术
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.