I have a modal window which closes when i add an item. The parent page will refresh once the modal window is closed. But i don't want the whole window to get closed, but i want a particular div to get refreshed. is there any javascript way to do it ?
I have a modal window which closes when i add an item. The parent page will refresh once the modal window is closed. But i don't want the whole window to get closed, but i want a particular div to get refreshed. is there any javascript way to do it ?
Share Improve this question asked Nov 22, 2011 at 7:07 BalaBala 3,62810 gold badges47 silver badges75 bronze badges 2- 1 its an ordinary jquery plugin with show_modal() – Bala Commented Nov 22, 2011 at 7:20
- could u name it so i can post plete answer ! – Synxmax Commented Nov 22, 2011 at 7:54
3 Answers
Reset to default 2You can call a javascript method in the parent window while closing the child window. This is very simple.
You can have a javascript method to refresh the content of the div
<script language=”javascript” type=”text/javascript”>
function ParentWindowFunction()
{
alert(‘Need to refresh targetdiv. I am instructed from child window’);
//refresh the div
return false;
}
</script>
And in the child window, you may have some button to close that window and also can call up the parent window's javascript
<script language=”javascript” type=”text/javascript”>
function CallParentWindowFunction()
{
window.opener.ParentWindowFunction();
return false;
}
</script>
<input type=”button” name=”btn1″ value=”Call Parent Window Function” onclick=”javascript:return CallParentWindowFunction();”/>
Look after onClosed or Something like that method in your modal documentation , Look into below link , if you using one of jquery plugins for modal it's cleaner to use jquery load() method by searching for Jquery Ajax Update Div
http://api.jquery./load/
http://www.dynamicdrive./dynamicindex17/ajaxcontent.htm
I got a solution for this..firstly i would like to thank everyone above for giving their thoughts.
I just called the onload function of the div with the closemodal function which is being called while closing the modal window. it worked.
The modal window closes as per the ajax response. Onsuccess i called the onload function in the parent form. I will update with the code shortly.!
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745609429a4635860.html
评论列表(0条)