(Rails) 使用“link_to_remote” 与弹出/弹出窗口结合使用...?
“link_to_remote”并弹出包含数据的窗口的最直接的机制是什么? 我需要“link_to_remote”,因为我需要将某些数据与 url 一起传递,而不需要重做我的路线。 如果“link_to”可以更好地服务而不需要重做我的路线,我完全赞成。 我根本无法让它工作,atm。
想法?
What is the most straightforward mechanism by which to "link_to_remote" and popout a window with the data? I need "link_to_remote" because I need to pass certain data along with the url without redoing my routes. If this would be better served by a "link_to" without the need to redo my routes, I'm all for it. I simply can't get it to work, atm.
Thoughts?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
也许您正在寻找类似的东西:
Perhaps you're looking for something like:
link_to_remote
用于执行XHR
请求,因此您不能使用它来打开包含响应的弹出窗口。无论如何,您不需要重做您的路线,因为我假设如果您想使用
link_to*
来获取一些数据,那么您已经定义了控制器/操作对并可以访问。此外,通常,Rails 应用程序会启用
catch all
路由来匹配:controller/:action
。 如果这是您的情况,那么您可以使用该控制器/操作的link_to
来获取数据。link_to_remote
is used to doXHR
requests, so you cannot use it to open a popup window with the response.You don't need to redo your route anyway, because I assume that if you want to use
link_to*
to get some data, then you have your controller/action pair defined and accessible already.Also, usually, Rails applications have the
catch all
route enabled to match:controller/:action
. If that's your case, then you can uselink_to
that controller/action to get the data.你指的是什么窗口? 模态窗口 ? 如果你想通过模态窗口显示一些数据,那么我建议你使用 http://prototype -window.xilinus.com/index.html,使用起来更方便,只需编写一些js函数并在rails helper/view中创建
link_to_function
来调用js函数即可。What window do u mean ? modal window ? if u want to show some data through modal window, then i suggest u to use http://prototype-window.xilinus.com/index.html, it easier to use, just write some js function and create
link_to_function
in rails helper/view to call the js function.