Reputation: 1571
I have to redirect my page to another page,but in the same directory. For example: www.test.com/demo/test.php I have to redirect to :
www.test.com/demo/check.php
And because that i have a lot of environment like dev QA production i have to keep the beginning of the path and just redirect to another page.
If i write:
function redirect (){
document.location = '/check.php'; //redirect me to www.test.com/check.php
}
Thanks.
Upvotes: 3
Views: 3940
Reputation: 5260
I'm not really sure what you're asking here, but if if all you're asking is how to redirect to a file in the same directory, simply remove the /
from your code.
function redirect (){
document.location = 'check.php';
}
Upvotes: 3