admin管理员组文章数量:1024637
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.!
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.!
本文标签: javascriptHow to refresh a particular div after closing a modal windowStack Overflow
版权声明:本文标题:javascript - How to refresh a particular div after closing a modal window? - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745609428a2158915.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论