<legend id='lA0en'><style id='lA0en'><dir id='lA0en'><q id='lA0en'></q></dir></style></legend>

    1. <tfoot id='lA0en'></tfoot>

        <bdo id='lA0en'></bdo><ul id='lA0en'></ul>

        <small id='lA0en'></small><noframes id='lA0en'>

      1. <i id='lA0en'><tr id='lA0en'><dt id='lA0en'><q id='lA0en'><span id='lA0en'><b id='lA0en'><form id='lA0en'><ins id='lA0en'></ins><ul id='lA0en'></ul><sub id='lA0en'></sub></form><legend id='lA0en'></legend><bdo id='lA0en'><pre id='lA0en'><center id='lA0en'></center></pre></bdo></b><th id='lA0en'></th></span></q></dt></tr></i><div id='lA0en'><tfoot id='lA0en'></tfoot><dl id='lA0en'><fieldset id='lA0en'></fieldset></dl></div>

        使用 Ruby on Rails 的 Ajax 弹出框

        Ajax pop up box using Ruby on Rails(使用 Ruby on Rails 的 Ajax 弹出框)
          <tbody id='XIPWv'></tbody>

          <small id='XIPWv'></small><noframes id='XIPWv'>

              <bdo id='XIPWv'></bdo><ul id='XIPWv'></ul>
                <i id='XIPWv'><tr id='XIPWv'><dt id='XIPWv'><q id='XIPWv'><span id='XIPWv'><b id='XIPWv'><form id='XIPWv'><ins id='XIPWv'></ins><ul id='XIPWv'></ul><sub id='XIPWv'></sub></form><legend id='XIPWv'></legend><bdo id='XIPWv'><pre id='XIPWv'><center id='XIPWv'></center></pre></bdo></b><th id='XIPWv'></th></span></q></dt></tr></i><div id='XIPWv'><tfoot id='XIPWv'></tfoot><dl id='XIPWv'><fieldset id='XIPWv'></fieldset></dl></div>

                1. <tfoot id='XIPWv'></tfoot>
                2. <legend id='XIPWv'><style id='XIPWv'><dir id='XIPWv'><q id='XIPWv'></q></dir></style></legend>
                  本文介绍了使用 Ruby on Rails 的 Ajax 弹出框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  这是一个非常基本的问题,但我找不到一个好的答案.我的 Rails 应用程序中有一个页面,其中有许多可以标记"的对象.单击标志按钮应该会显示一个带有确认、小表单等的小框.问题是我不知道如何使用 RJS 模板来执行此操作.

                  This is a pretty basic question but I can't find a good answer for it. I have a page in my Rails app where there are many objects that can be 'flagged'. Clicking the flag button should display a little box with a confirmation, little form, etc. The trouble is I can't figure out how to do this using RJS templates.

                  我一直在使用 page.insert_html,但这需要一个 ID.为了完成这项工作,我必须为每个可以标记的事物分配一个唯一 ID.这看起来不是很干净,仍然让我想知道确保只能显示一个表单并且该框在提交时消失.这个问题有更简单的解决方案吗?我本质上想创建类似于 SO 上出现的标志框的东西.抱歉,我对 RJS 模板比较陌生.谢谢.

                  I've been using page.insert_html but this requires an ID. In order to make this work I had to assign each thing that can be flagged a unique ID. This doesn't seem very clean and still leaves me wondering about making sure only one form can be displayed and that the box disappears on submit. Is there a more simple solution this problem? I essentially want to create something similar to the flag boxes that appear on SO for a flag. Sorry, I'm relatively new to RJS templates. Thanks.

                  推荐答案

                  你可以使用 jquery 脸盒.这种事情最好不要在 rjs 中完成,但在不显眼的 javascript 中,这就是现在每个人都在前进的地方,它更干净.您可以将 facebox rel 附加到您的链接,然后单击它可以在弹出窗口中打开表单.

                  You could do this with the jquery facebox. This kind of thing is better not done in rjs, but in unobtrusive javascript, that's where everyone is heading these days, it's much cleaner. You can attach the facebox rel to your links, then when clicked it can open the form in a popup window.

                  然后在您的弹出窗口中,您可以执行表单和重定向或其他操作.用户将只能单击一个,因为当弹出窗口打开时,覆盖层会覆盖在页面上,因此在其外部单击无效或关闭表单(我认为您在配置中选择).

                  Then in your popup window you can do your form and redirect or whatever. The user will be only able to click one as when the pop up window opens an overlay is put over the page so clicking outside it either has no effect or closes the form (I think you choose in the config).

                  听起来不错.

                  这篇关于使用 Ruby on Rails 的 Ajax 弹出框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Fetch multiple links inside foreach loop(在 foreach 循环中获取多个链接)
                  Backbone Fetch Request is OPTIONS method(Backbone Fetch Request 是 OPTIONS 方法)
                  Fetch API leaks memory in Chrome(Fetch API 在 Chrome 中泄漏内存)
                  How can I download and save a file using the Fetch API? (Node.js)(如何使用 Fetch API 下载和保存文件?(Node.js))
                  Send blob data to node using fetch, multer, express(使用 fetch、multer、express 将 blob 数据发送到节点)
                  Sending a custom User-Agent string along with my headers (fetch)(发送自定义用户代理字符串以及我的标头(获取))
                3. <i id='0pKis'><tr id='0pKis'><dt id='0pKis'><q id='0pKis'><span id='0pKis'><b id='0pKis'><form id='0pKis'><ins id='0pKis'></ins><ul id='0pKis'></ul><sub id='0pKis'></sub></form><legend id='0pKis'></legend><bdo id='0pKis'><pre id='0pKis'><center id='0pKis'></center></pre></bdo></b><th id='0pKis'></th></span></q></dt></tr></i><div id='0pKis'><tfoot id='0pKis'></tfoot><dl id='0pKis'><fieldset id='0pKis'></fieldset></dl></div>

                    <small id='0pKis'></small><noframes id='0pKis'>

                        <tbody id='0pKis'></tbody>
                      <tfoot id='0pKis'></tfoot>
                        <bdo id='0pKis'></bdo><ul id='0pKis'></ul>
                      • <legend id='0pKis'><style id='0pKis'><dir id='0pKis'><q id='0pKis'></q></dir></style></legend>