jquery - Reload page out of iframe -
jquery - Reload page out of iframe -
i'm using fancybox , zend. hope next clear.
on www.example.com/template/edit/id/3 have jquery ui tabs. reachable straight via anchors. e.g. www.example.com/template/edit/id/3#tabs-2
on #tabs-2 have elements, doesn't matter exactly. can create or edit them. elements got own controller, editing them phone call /elements/edit/id/44. currently, i'm doing in layer fancybox. i'm using iframe functionality of fancybox that.
so, if on /template/edit , click on edit button of element, layer opens includes iframe loads /elements/edit.
so, if alter element , click on save, want layer automatically close , reload.
fancybox provides alternative specify should when gets closed. @ moment got that:
'onclosed' : function() {window.location.reload();}
this reloads top window , not iframe. also, there's possibility close fancybox via js. i'm doing setting view variable triggers this, e.g:
<?php if($this->close): ?> <script type="text/javascript"> parent.$.fancybox.close(); </script> <?php endif ?>
so, if saving set $this->view->close = true , layer gets clsoed triggers js.
this works fine. problem reloading having #tabs-2 in url.
of course of study urls, clean other anchors user typed in etc. , build url set window's location, somehow think, there must easier solution.
e.g. setting url of browser #tabs-2 without reloading, sounds not nice. reloading easy having anchor there quite tricky.
window.location.href = "#tabs-2"
maybe:
<script type="text/javascript"> parent.$.fancybox.close(); window.location.href = "#tabs-2" //add anchor, won't stack. replace existing anchor window.location.reload() //refresh screen, maintain anchor </script>
jquery iframe fancybox
Comments
Post a Comment