我有一个页面list.jsp
有一个表中的所有记录列表和一个按钮在顶部添加新的记录。如何在javascript中关闭弹出窗口后刷新父页面?
我想打开add.jsp
作为一个弹出窗口。此作品,但是当我关闭弹出窗口如何更新list.jsp
使其显示新添加的记录
这里是我的代码是什么我想...
的List.jsp
<html> <head> <script> function popupwindow(url, title, w, h) { var left = (screen.width/2)-(w/2); var top = (screen.height/2)-(h/2); popupWindow = window.open(url, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left); return popupWindow } </script> </head> <body> <input type="button" value="Add new" id="add-btn" onclick="popupwindow('Addnew.jsp','Add new',600,400)"/> <table> // Here i am showing all records from database... </table> </body>
add.jsp
<html> <head> <script type="text/javascript"> $(document).ready(function(){ $("#savebtn").click(function(e) { $.ajax({ type: "POST", url: "RecordHandler", data: dataString, success: function(data){ $('body').html(data); $('#msg').html('New Record Added Successfully.') } }); }); </head> <body> <form method="POST"> <table> <tr> <td>Folder Number</td> <td><input type="text" name="folderno"/></td> </tr> <tr> <td>Box Number <b style="color:red">*</b></td> <td><input type="text" name="boxno"/></td> </tr> <tr> <td colspan=2> <input type="submit" value="Save" name="save" id="savebtn"/> </td> </tr> </table> </form>
看到这个答案http://stackoverflow.com/questions/10792408/open-popup-and-refresh-parent-page-on-close-popup –
谢谢Squirerl其工作..... –
好听:) –