jQuery Popup Window Return Value to Parent(jQuery弹出窗口返回值给父级)
问题描述
如何使用 jQuery 完成以下操作:单击子窗口中的链接时,打开一个弹出窗口,该窗口返回一个值给父窗口,关闭子窗口,然后让父窗口自动提交基于返回的值?
How can I accomplish the following using jQuery: Open a popup window that returns a value to the parent window when a link in the child window is clicked, close the child window, and then have the parent automatically submit a form based on the value returned?
我意识到 jQuery Dialog 是一种流行的解决方案,但我需要一个弹出窗口,因为窗口的内容需要可导航,并且我想避免在 jQuery Dialog 中使用 iframe.
I realize that the jQuery Dialog is a popular solution, but I require a popup window because the window's contents need to be navigable, and I want to avoid using an iframe in the jQuery Dialog.
弹出窗口将用于收集多个值,最终以分隔字符串的形式返回给父级,但此数据收集需要在提交父级窗口的表单之前进行.如果实体选择器"有标准设计模式,那就是它.
The popup window is going to be used to collect more than one value, ultimately to be returned as a delimited string to the parent, but this data collection needs to occur prior to the submission of the parent window's form. If there were a standard design pattern for an "Entity Picker", this would be it.
这需要在 IE8、FF3.6、Safari 4 和 Chrome 5 中运行.
This needs to work in IE8, FF3.6, Safari 4, and Chrome 5.
谢谢,标记
推荐答案
这是我的解决方案:
var parent = $(parent.document.body);
$(parent).find('input#valStore').val(theVal);
$(parent).find('form#myForm').submit();
window.close();
这篇关于jQuery弹出窗口返回值给父级的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:jQuery弹出窗口返回值给父级


- Web Api 中的 Swagger .netcore 3.1,使用 swagger UI 设置日期时间格式 2022-01-01
- WebMatrix WebSecurity PasswordSalt 2022-01-01
- 在哪里可以找到使用中的C#/XML文档注释的好例子? 2022-01-01
- 如何用自己压缩一个 IEnumerable 2022-01-01
- MoreLinq maxBy vs LINQ max + where 2022-01-01
- 带有服务/守护程序应用程序的 Microsoft Graph CSharp SDK 和 OneDrive for Business - 配额方面返回 null 2022-01-01
- 良好实践:如何重用 .csproj 和 .sln 文件来为 CI 创建 2022-01-01
- C# 中多线程网络服务器的模式 2022-01-01
- C#MongoDB使用Builders查找派生对象 2022-09-04
- 输入按键事件处理程序 2022-01-01