i am using javascript, php, mysql.
I have a button on 'index.php'. A new window will open on click of this button(not new tab)
The code is like this.
function getUtilities(sid,sfname,smobnum,subdid)
{
var url='';
url="update.php?sid="+sid+"&sfname="+sfname+"&smobnum="+smobnum+"&subdid="+subdid;
popupNote(url);
}
function popup(url)
{
var width = 500;
var height = 200;
var left = (screen.width - width)/2;
var top = (screen.height - height)/2;
var params = 'width='+width+', height='+height;
params += ', top='+top+', left='+left;
params += ', directories=no';
params += ', location=no';
params += ', menubar=no';
params += ', resizable=no';
params += ', scrollbars=yes';
params += ', status=no';
params += ', toolbar=no';
newwin=window.open(url,'windowname5', params);
if (window.focus) {newwin.focus()}
return false;
}
So i will have my popup opened. i am performing some update operation.. and i'l close it. After closing the popup i want to refresh my 'index.php'. But i am unable to do that.
i am using javascript, php, mysql.
I have a button on 'index.php'. A new window will open on click of this button(not new tab)
The code is like this.
function getUtilities(sid,sfname,smobnum,subdid)
{
var url='';
url="update.php?sid="+sid+"&sfname="+sfname+"&smobnum="+smobnum+"&subdid="+subdid;
popupNote(url);
}
function popup(url)
{
var width = 500;
var height = 200;
var left = (screen.width - width)/2;
var top = (screen.height - height)/2;
var params = 'width='+width+', height='+height;
params += ', top='+top+', left='+left;
params += ', directories=no';
params += ', location=no';
params += ', menubar=no';
params += ', resizable=no';
params += ', scrollbars=yes';
params += ', status=no';
params += ', toolbar=no';
newwin=window.open(url,'windowname5', params);
if (window.focus) {newwin.focus()}
return false;
}
So i will have my popup opened. i am performing some update operation.. and i'l close it. After closing the popup i want to refresh my 'index.php'. But i am unable to do that.
Share asked Nov 3, 2014 at 7:40 MatarishvanMatarishvan 2,4323 gold badges42 silver badges71 bronze badges 2-
you can use
location.reload()
. – Sougata Bose Commented Nov 3, 2014 at 7:42 - where do i use? index.php? or update.php? i need to reload after performing some action in update.php(new window) – Matarishvan Commented Nov 3, 2014 at 7:44
1 Answer
Reset to default 7You will want to run the following JS on the popup window when you are ready to reload the parent page and close the popup.
<script>
window.opener.location.reload();
window.close();
</script>