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弹出窗口返回值给父级
基础教程推荐
- .NET SerialPort DataReceived 事件未触发 2022-01-01
- Moq It.Is<>不匹配 2022-01-01
- 当值可以是对象或空数组时反序列化 JSON 2022-01-01
- C# 从 List<List<int>> 中删除重 2022-01-01
- Azure Functions:CosmosDBTrigger 未在 Visual Studio 中触发 2022-01-01
- 如果有人提交恶意软件Nuget包怎么办? 2022-01-01
- 禁止输入少量字符,例如'<'、'&a 2022-01-01
- 我应该在后面的代码中直接使用 Linq To SQL 还是使 2022-01-01
- WPF 模态进度窗口 2022-01-01
- 如何使用 .Net 检查 Active Directory 服务器是否已启动并正在运行? 2022-01-01
