I'm using Joomla 3 and want to use Javascript to find the base url of the page, extend this url with some other bits and send a variable through the url. Then open this page in the same window.
Specifically if the base url is 'www.webpage.com', I would like to add '\index.php\animals' and then a variable '?delete=true'.
So far my code looks like this:
var urlRedirect = location.host + '/index.php/animals?delete=true';
window.open(urlRedirect,"_self",false);
If I use an alert to view urlRedirect I can see the entire url I would expect eg www.webpage.com/index.php/animals?delete=true but the page is not opening where I want. It is just going to be the base url, I suspect the default page if a weird url is entered.
What code should I use to do this?
www.webpage.com/index.php/animals?delete=true
into your address bar and then go there, does it do what you expected?