【发布时间】:2016-01-02 11:38:05
【问题描述】:
我正在为个人网络应用程序使用 rails 4 和 javascript。这是问题所在:
当我点击<button> 时,我想随机更改<audio> 的值。
为了生成<audio> 的路径,我使用了一个ruby 函数,它从数据库中返回声音的值。我想做的是单击<button>,每次单击它时,<audio> 的值都会更改而无需重新加载页面。
这是和示例:
<button> Click me!</button>
<audio><source src="<%= $soundpath %>"></audio>
/* I click on the button and the sound path into src="" should change everytime i click on the button without reloading the page*/
<audio><source src="<%= $soundpath %>" <--[this should be different from the previus one]></audio>
【问题讨论】:
标签: javascript jquery ruby-on-rails audio