子窗口关闭时的回调函数调用
单击按钮时,我打开了子窗口。在此窗口中,我将一些数据保存到数据库中。
我想在子窗口关闭时调用另一个java脚本函数。
I have open child window when click on button.In this window I have save some data into database. I want to call another java script function when child window is close.
我已经尝试过这个在javascript 解决方案中将回调函数设置为新窗口,但它无效。
I have already tried this Set a callback function to a new window in javascript solution but it is not working.
那么请告诉我如何调用回调函数?
So please tell me how to call callback function ?
我成功保存后还从子窗口设置了一个隐藏字段。我已经尝试在更新之前提醒这个隐藏值但是它的警报。
I have also set one hidden field from child window after successfully save.I have try to alert this hidden value but its alert before updating.
function open_child()
{
$("#child_succ").val(0);
alert($("#child_succ").val());
window.open("child.php","Ratting","width=550,height=300,left=150,top=200,toolbar=1,status=1");
alert($("child_succ").val());
}
回调功能
function test()
{
alert("called from child window");
}
您可以调用父函数从子窗口这样:
You may call a parent function from child window this way:
window.opener.your_function()
在父窗口中调用子函数:
To call a child function in parent window:
var w = window.open(somelocation,''); //has a function on `window` called "test"
w.test();
如果这些提示有任何帮助,您可以向我们展示您如何使用回调方法。
If any of this tips help you, you may show us how the callback approach was used by you.
希望这可以帮到你。
问候!