I'm creating a web application using AJAX (Sajax PHP library).
To allow a user to add a category to a select box, I have a link trigger a new window to open via window.open().
This window collects the information, and submits it to a function that calls the add routine via AJAX. In the callback method - if the add routine was successful, it closes the window that was opened.
Everything works fine, except for the closing of the window - which is acting strangely. It doesn't close right away, I have to either click on the document area of the opened window, or switch focus to another window and back again.
Here is the code in the callback method (and also the opening function as well):
Anyone have any ideas?
To allow a user to add a category to a select box, I have a link trigger a new window to open via window.open().
This window collects the information, and submits it to a function that calls the add routine via AJAX. In the callback method - if the add routine was successful, it closes the window that was opened.
Everything works fine, except for the closing of the window - which is acting strangely. It doesn't close right away, I have to either click on the document area of the opened window, or switch focus to another window and back again.
Here is the code in the callback method (and also the opening function as well):
Code:
var popupWins = new Array();
function nw(obj,name,w,h){
if( typeof w == "undefined" )
w = 500;
if( typeof h == "undefined" )
h = 500;
leftVal = (screen.width - w) / 2;
topVal = (screen.height - h) / 2;
var attrS = 'left=' + leftVal + ',top=' + topVal + ',width=' + w + ',height=' + h;
popupWins[name] = window.open(obj.href, name, attrS);
if( window.focus ){ popupWins[name].focus(); }
return false;
}
function addPlatform_cb(z){
z = parseInt(z);
if( z > 0 ){
window.focus();
popupWins['new_entry'].close();
updateDisplay(platform);
}else
popupWins['new_entry'].error('Platform "{0}" could not be created.');
}
Anyone have any ideas?