Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
23
rated 0 times [  28] [ 5]  / answers: 1 / hits: 19576  / 10 Years ago, thu, march 20, 2014, 12:00:00

I have this portion of the code. I want to know how can I read the url as the current page instead a fix url



Here is the portion of the coding:



var str='';
if(model_id != 0 ) str = model_id++;
if(year_id != 0 ) str +=year_id++;
url='http://store.ijdmtoy.com/SearchResults.asp?Search='+str;
top.location.href=url;


You see currently it has a fix reading the url http://store.ijdmtoy.com/SearchResults.asp



For example, I am currently on http://store.ijdmtoy.com/abs.htm



How can I change the code so it will automatically read as http://store.ijdmtoy.com/abs.htm?searching=Y&Search


More From » url

 Answers
9

If you are currently on http://store.ijdmtoy.com/abs.htm then document.URL will be http://store.ijdmtoy.com/abs.htm.



You can try:



url = location.protocol + '//' + location.host + location.pathname + '?Search=' + str;


[#71892] Tuesday, March 18, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
keyonna

Total Points: 521
Total Questions: 104
Total Answers: 96

Location: Samoa
Member since Tue, May 3, 2022
2 Years ago
;