How to create a subdomain and receive parameters in JS?

I’m trying to add a bunch of parameters into my website. So my Url would look like: “www.[website].com?[parameters]

Out of this, the parameters part would be processed by the javascript in my website. My website address is: “db-downloader.000webhostapp.com”.

If I try to visit a url with any parameter say “www.db-downloader.000webhost.com?query=true”, I’m redirected to: “error404.000webhost(.com)”. I don’t know why the page redirects instead of taking me to my website as the main domain name stays the same?

Can someone please help me, I’m new to web development! Also, sorry for wrapping up the .com's in parentheses uselessly, wasn’t allowed to put more than one link in the post!

That’s not a valid URL. At a minimum, you need this:

www.db-downloader.000webhost.com/?query=true

That would request the default document from the web server, which is one of index.php, index.html or index.html. You probably want the first one, since you’re doing something dynamic.

2 Likes

I’m trying to add at a time bunch of parameters into my website. So my Url would look like: “www.[website].com?[parameters]” Out of this, the parameters part would be processed by the javascript in my website

Check this

Use the get paramater of the url in javascript Get query string values in JavaScript In Javascript, how can I get the parameters of a URL string,hey start to look for parameters on the url from ? and also from the hash # . Then for each parameter they split in the equal sign

You can even use PHP for that. Can you please explain what you really need to do?

1 Like