如何将数据从子窗口(mvc)窗口传递给父窗口?几秒钟前的链接
在这种情况下,我需要将一些数据从子(MVC)页面传递给父窗口。但是在这种情况下,用户不需要与子窗口进行任何交互。子窗口将通过单击按钮从父窗口打开,以运行服务器端进程并将一些代码值返回给父窗口,并且需要关闭。
我不知道如何将数据从mvc页控制器传递到父页,以及如何关闭子窗口本身。
有什么建议吗?
发布于 2014-04-12 15:05:28
我想这可能会回答你的问题:
父窗口- parent.asp
<html>
<script language="javascript">
function openwindow() {
retval=window.showModalDialog("child.asp")
document.getElementById('passedChild').value=retval
}
</script>
<body>
<form name=frm>
<input name="passedChild" id="passedChild" type=text>
<input type=button onclick="javascript:openwindow()" value="Open Child">
</form>
</body>
</html>子窗口- child.asp
<html>
<head>
<%
'... i work in classic asp so can run asp here and then flow into JS for retrun
%>
//
<script language="javascript">
function changeparent() {
window.returnValue="passed value"
window.close()
}
</script>
</head>
<body>
<form>
<input type=button onclick="javascript:changeparent()" value="Change passedChild">
</form>
</body>
</html>https://stackoverflow.com/questions/22875955
复制相似问题