i am refreshing parent window from popup window,then calling parent window jquery expressions not works. But when i enable the alert call in closePopup function in the popup.php everything works fine. - whats wrong with me?
file test1.html
<script type="text/javascript" src="jquerymin.js"></script>
<script type="text/javascript">
var visible_status=0;
function selectFn(sno){
if(sno==1){
$('#id2').hide();
$('#id1').show();
visible_status=1;
}else if(sno==2){
$('#id2').show();
$('#id1').show();
visible_status=2;
}
}
function popitup(url) {
newwindow=window.open(url+'?parent_status='+visible_status,'name','top=300,width=400,height=250');
if (window.focus) {newwindow.focus();}
return false;
}
</script>
<select name='optionw' onchange="selectFn(this.options[this.selectedIndex].value);">
<option value="">Select</option>
<option value="1">Div1</option>
<option value="2">All</option>
</select>
<div id='id1' style="display:none;">DIV1</div>
<div id='id2' style="display:none;">DIV2</div>
<button onclick="popitup('popup.php');">popUp</button><br>`
my popup.php file
<script type="text/javascript" src="jquerymin.js"></script>
<script type="text/javascript">
var parent_status='<? echo $_GET[parent_status];?>';
function closePopup() {
window.opener.history.go(0);
//alert('going to call parent selectFn('+parent_status+')');
window.opener.selectFn(parent_status);
self.close();
}
</script>
...Here editing a part of the main page content...
<input type=button value=close_popup onclick="closePopup();">
after closing this popup i need ,
- main page to be reloaded ( to show the edited content)
- to restore the div visible status as before clicking this popup.