Demo of reloading part of parent window on closing of child


This is part of the parent window to reload
Number of reloades=



JQuery Parent Window

<script>
$(document).ready(function() {
var newWin; // declaring global variable 

////////////////////////////
$("#b_open").click(function(){
newWin = window.open("window-child-reload.php");
newWin.onunload = my_load;
})
//////////////
$("#b_close").click(function(){
newWin.close(); 
newWin.onunload = my_load;
})
/////////
function my_load(){
if(newWin.location != "about:blank"){ // Don't do any thing if child window is open
var str=$('#t1').val();
str=parseInt(str)+1;
$("#t1").attr('value',str);	
}
}
////////////////
})
</script>

JQuery Child Window

<script>
$(document).ready(function() {
//////////////
$("#b2").click(function(){
self.close(); 
})
///////
})
</script>

HTML Parent Window

<input type='text' class='form-control' id='t1' value=0> 
<button type='button' class='btn btn-success btn-lg ' id='b_open'>Open Child Window</button>
<button type='button' class='btn btn-danger btn-lg ' id='b_close'>Close Child Window</button>