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弹出窗口返回值给父级
基础教程推荐
- SSE 浮点算术是否可重现? 2022-01-01
- 有没有办法忽略 2GB 文件上传的 maxRequestLength 限制? 2022-01-01
- 将 Office 安装到 Windows 容器 (servercore:ltsc2019) 失败,错误代码为 17002 2022-01-01
- rabbitmq 的 REST API 2022-01-01
- 为什么Flurl.Http DownloadFileAsync/Http客户端GetAsync需要 2022-09-30
- c# Math.Sqrt 实现 2022-01-01
- 如何激活MC67中的红灯 2022-01-01
- 将 XML 转换为通用列表 2022-01-01
- MS Visual Studio .NET 的替代品 2022-01-01
- 如何在 IDE 中获取 Xamarin Studio C# 输出? 2022-01-01