0

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.

changeme
  • 640
  • 2
  • 12
  • 36
  • IMO your syntax for calling load is wrong. jQuery api says that you can attach an event handler that will be called when the element and its children are completely loaded. Even if this is what you are trying to do the syntax for calling load is off. I don't think you can actually refresh the element with .load . Look at this post if you want to refresh the page. http://stackoverflow.com/questions/5404839/how-can-i-refresh-a-page-with-jquery – ShaggyInjun Jun 08 '12 at 21:21
  • not only just refresh but need to call an Struts2 action as well (refreshParent). – changeme Jun 09 '12 at 00:57
  • http://www.aoiblog.com/call-struts2-action-from-java-script/ – ShaggyInjun Jun 10 '12 at 02:35

1 Answers1

0

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();
});
Jadzia
  • 164
  • 1
  • 9