window.open(\"index.php\"); does not open the new page in the same tab, it opens it in a new tab.
I tried window.open(\"index.php\",
As far as I know, window.location doesn't do this. The right method to do this is:
document.location = 'url-you-want-to-open.ext';
Best thing is to either include the full path (if it's on a different domain) or the absolute path if it's on the same domain. Only use relative path if the destination document is in the same folder.
To add to this:
window = speaks to the browser and its tabs
document = speaks to the current document that's loaded in the browser / tab.
Instead of window.open you should use window.location = "http://...."
window.location is the function/property you should look at.
window.open will open in new tab if action is synchronous and invoked by user. If you remove async: false from ajax options (and this method is invoked by user for example by clicking a button), then new window will open instead of new tab. For simple navigation set window.location.href
The window.open function opens a new window(or tab). The window.location changes the url the current tab.