changeme
changeme

Reputation: 640

jquery popup submit should refresh parent window with struts2 action call

I have struts2 page with a modal window as include in a page. Onclick of a button popup will open and after entering values and clicking on submit the popup will close and parent page to be refreshed.

My Jsp: both popup and parent are in same jsp.

Main page
<form id="Parent">
<div id=container>
<table>
</table>
</div>
<input type="button" onclick="openPopup()">
</form>

<form id=popup>
   <input type="text" id="comments">
   <input type="button" id="popupBtn">
</form>

Js file

$.post("updateDB",{comments:comments}, function(){
    $('#popup').dialog('close');
    $('#container').load("refreshParent #container");
});

Updating DB and popup close is working but the .load is not working, can someone please help me where am I doing wrong.

Two things one the refreshParent action is not called, if it is called I need to refresh the parent form as well, how do I refer a DIV id of another form.

UPDATE: I forgot to mention that there are few rows with checkboxes which needs the submit values on click of submit on popup.

Thanks in advance.

Upvotes: 0

Views: 6940

Answers (1)

Jadzia
Jadzia

Reputation: 164

Below code is for if you opening popup in new window.

$.post("updateDB",{comments:comments}, function(){
window.opener.location.reload();
window.close();
});

So you can try something like in your case

$.post("updateDB",{comments:comments}, function(){
$('#popup').dialog('close');
window.location.reload();
});

Upvotes: 0

Related Questions