0
This Script aims to open a url by selecting value in comobox store the values in vars redir,redir2 and redir 3
function redirect(){
var obj = document.getElementById("cat"); //
var obj2= document.getElementById("sub1");
var obj3= document.getElementById("sub2");
var redir2=obj2.options[obj2.selectedIndex].text.substring(0,4);
var redir =obj.options[obj.selectedIndex].text.substring(0,4); //
var redir3 =obj3.options[obj3.selectedIndex].text.replace(/ /g,"_");
var url= redir+"/"+redir2+"/"+redir3+".php";
url=url.toLowerCase();
alert(url);
window.location.href = "np/categories/"+url;}
I can see that the browser is taking over the codeline, but it does not open the test page created for this purpose
on the console of Mozilla I see this message:
GET http://localhost/np/Categories/auto/Serv/test.php [HTTP/1.1 200 OK 0 ms]
The entire path is correct, however the page does not load, and simply re-load the current page, where I make the selection.
What is wrong with you ?
And what would be the current URL?
– mau humor
http://localhost/np/Combox/Combox.php
– Mr_sang
Try
window.location.href = "/np/categories/"+url;
– bfavaretto
I get this one. log to & #Xa; GET http://localhost/np/Categories/auto/Serv/teste.php [HTTP/1.1 200 OK 16 ms]
– Mr_sang
One method that works well is to use
window.open('tua_url', '_self');
– Thiago Santos
keeps the same problem. . assume and read the code, but does not load the page. So far I could only click if to open in another tab....
– Mr_sang
this method works, but I had to write it as follows: Alert(window.open("/np/Categories/"+url , '_self')); Without Alert it doesn’t work. I don’t get it. ??
– Mr_sang