tags:

views:

300

answers:

1

Hi,

I am using the jqModal plugin for modal dialogs on my page. I have a situation where one modal includes a form called via ajax (a seperate .aspx page that gets loaded into the modal window. as shown below)

 $('#mdl_new').jqm({ ajax: 'ajax/new_modal.aspx', trigger: '#options_add a' });

When the user fills in the form in the new_modal.aspx page and clicks on the submit button, I run some server side code then I need to update a div on the main page, while the modal is still shown.

Is this possible?

A: 

try the .onHide handler of jqmodal. It allows you to trigger actions when the user chooses to close the dialog.

 .onHide: function(h) { 
      t.html('Please Wait...');  // Clear Content HTML on Hide.
      //perform your div manipulation here
      h.o.remove(); // remove overlay
      h.w.fadeOut(888); // hide window
    }
Franz
In order to achieve what I am trying to accomplish, I need a way to reference the parent window as the modals content is another web page pulled from the server. This page has a button, which when clicked, has to update a div in the parent page..
Emin
You don't need to reference anything... jqmodal's ajax function simply inserts the visible HTML from your AJAX page to a div or iframe on your current page... it doesn't create a new window object .
Franz
yes but how do I call a function that exists in the parent page, from within the "frame" page's button click event? (function:jquery function). if I move the code that handles the button click from the frame page to the parent page, then as soon as the button is clicked, it tries to take me to the url contained in the $(get) function in the button click event (button click makes an ajax call)If I call the function that is in the parent page from within the frame page, then it says function name not defined.. so it seems like I have no choice and duplicate my function for both pages...
Emin
IMHO you shouldn't rely on the fact that jqmodal renders an iframe, AFAIK it only does this when you are using IE6.there are quite a few threads here that deal with function invocation from/off iframes, like: http://stackoverflow.com/questions/251420/invoking-javascript-in-iframe-from-parent-page
Franz