Ruby on Rails
Thursday, May 29, 2014
I've used the gon gem for this and liked it quite a bit.
https://github.com/gazay/gon
Pierre-Andre M. wrote:
I have a variable created by some ruby in my controller that looks like
this:
@begpoint = row["begpoint"]
and I want to pass it into some js that is referenced from within my
view:
view:
<% javascript_include_tag "play_time" %>
js (play_time):
I am trying to pass "<beg-point> into the js [obviously that<> is not
the right syntax just trying to denote where'd id like the variable to
end up]
var endtime =<beg-point>+10;
myPlayer= document.getElementById('example_video_1');
myPlayer.addEventListener('loadeddata', function(){
myPlayer.currentTime = 10505.89;
myPlayer.play();
myPlayer.addEventListener('timeupdate', function(){
if (myPlayer.currentTime>= endtime) {
myPlayer.pause();
}
Can anyone help? Thanks
}, false);
}, false);
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment