javascript - Refresh Iframe when the Dialog modal Closes -


im new jquery dialogs , iframes , want ask if can refresh static iframe when dialog modal closes.

heres static iframe:

                    <iframe id="frameuserinfo" src="/user/userinfo" style="border: none; width: 100%;                         min-height: 220px;"></iframe>                 </div> 

and jquery dialog

$("#dialogaddphone").dialog({             autoopen: false,             resizable: false,             modal: true,             width: 700,             height: 700,             position: ['center', 40],             close: function (event, ui) {                 $('#dialogaddphone').attr('src', '');             }         }); 

i tried adding $('#frameuserinfo').reload(true); not working

just want give better picture, in parent window, theres static iframe contains button opens $("#dialogaddphone") click event being called @ /user/userinfo

this 1 in parent window:

<div id="dialogaddphone" title="document upload" style="overflow-y: hidden;">     <iframe id="myiframeaddphone" src="" style="border: none; width: 100%; height: 100%;">     </iframe> </div> 

then open event in static iframe in user/userinfo

loadiframe('myiframeaddphone', href);  parent.$("#dialogaddphone").dialog("open");  return false; 

then after closing dialog , should refresh iframe of frameuserinfo

thanks! :)

you can use following :

first method:

$("#dialogaddphone").dialog({         autoopen: false,         resizable: false,         modal: true,         width: 700,         height: 700,         position: ['center', 40],         close: function (event, ui) {             $('#dialogaddphone').attr('src', '');             document.getelementbyid('frameuserinfo').contentwindow.location.reload(); //reloads iframe         }     }); 

second method:

set source of iframe again. refresh iframe.

$("#dialogaddphone").dialog({     autoopen: false,     resizable: false,     modal: true,     width: 700,     height: 700,     position: ['center', 40],     close: function (event, ui) {         $('#dialogaddphone').attr('src', '');         var iframe = document.getelementbyid('frameuserinfo');         iframe.src = iframe.src;//reloads iframe     } }); 

the first method wont work in chrome there no contentwindow property. should go second method.

here demo same using second method.


Comments

Popular posts from this blog

multithreading - Exception in Application constructor -

React Native allow user to reorder elements in a scrollview list -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -