【问题标题】:Render to a html page in the same page on click of a button in Ruby on Rails in a particular position在特定位置单击 Ruby on Rails 中的按钮时呈现到同一页面中的 html 页面
【发布时间】:2014-06-17 14:09:54
【问题描述】:

我是 Ruby 新手,我需要通过单击按钮重定向到 html 页面。 单击帮助按钮时,我需要在同一窗口中显示一个 html 页面,它应该显示在 在当前窗口的中心与之前的内容在顶部相同。

我在 erb 文件中的代码:

<script type='text/javascript'>
    window.open('../redmine_portals/Redmine Portals.html', '_self');
    window.moveTo(10, 20);
</script>

请帮我看看怎么做,参考图片。

谢谢

塞卡

【问题讨论】:

  • 你想用ajax来做吗?

标签: javascript html ruby-on-rails ruby


【解决方案1】:

我建议用一些 JS,你渲染一个部分。

例如:

<button onclick="showPartial()">Click me</button>

<%= render partial: "pathto/partial"%>

在部分中,我会有一些你会用 JS 展示的东西

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-10-17
    • 1970-01-01
    • 2012-05-09
    • 2021-10-02
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多