get values from ruby to javascript -
Rail is new to Ruby. I want to get value from ruby to java script. Here the code is using iam.
What do I want to do that I want to create a data variable in Jason format which remains with speed and time values from Ruby. Static values are used above
& lt; Table border = '1' = 'center' class = "table-table-striped" & gt; & Lt; TR & gt; & Lt; Th & gt; Id & lt; / Th & gt; & Lt; Th & gt; Speed & lt; / Th & gt; & Lt; Th & gt; Time & lt; / Th & gt; & Lt; / TR & gt; & Lt;% @ properties.each do | C | & Gt%; & Lt; TR & gt; & Lt; Td> & Lt;% = c.device_id% & gt; & Lt; / Td> & Lt; Td> & Lt;% = c.speed% & gt; & Lt; / Td> & Lt; Td> & Lt;% = c.time% & gt; & Lt; / Td> & Lt; / TR & gt; & Lt;% end% & gt; & Lt; / Table & gt;
& lt; P & gt; & Lt; Div align = 'center' & gt; Available time vs. speed details are listed below & lt; / Div & gt; & Lt; / P & gt; & Lt; Div id = "bar-demo" align = "center" & gt; & Lt; Script type = "text / javascript" & gt; Var data = "[[['time': '1', 'speed': '0'}, {'time': '2', 'speed': '1'}]] Can i use ruby code like this in javascript?
Comments
Post a Comment