convert sql server table data to json variable in view

256
August 26, 2017, at 03:15 AM

Can anyone help me with this, I have a table in the database with two columns 'time [datetime]' and 'value [decimal]'. I would like to convert it to a json variable so that i can use in the view(jquery).

I would like the data to be in this format:

var json = [{
  "Time": "2017-08-17 16:35:28.000",
  "Value": "3.85"
}, {
  "Time": "2017-08-17 17:36:28.000",
  "Value": "3.85"
}, {
  "Time": "2017-08-17 18:35:28.000",
  "Value": "3.86"
}];
READ ALSO
jquery text() method with blank spaces

jquery text() method with blank spaces

With $('h1')text(), I can have all the text of the h1 that exist in the body (there's only one h1 element)

225
Sum Values from Multiple jQuery Sliders

Sum Values from Multiple jQuery Sliders

I'm trying to set up a series of jQuery sliders and then have a field that displays the sum of the values that each slider representsI thought this could be simple, but my novice self is running into a roadblock

263
Uncaught ReferenceError: function is not defined with onclick with angular form and js

Uncaught ReferenceError: function is not defined with onclick with angular form and js

I've tried a few different ways to solve this but no luck:

323
symfony pass argument to JQuery

symfony pass argument to JQuery

I'm new in symfony as well as JQuery

252