I have a url
http://localhost:8162/UI/UsersDetail.aspx?id_temp=U0001
I want to get string use javascript
?id_temp=U0001
Thank guys.
I have a url
http://localhost:8162/UI/UsersDetail.aspx?id_temp=U0001
I want to get string use javascript
?id_temp=U0001
Thank guys.
If this isn't the location of the page, you may use
var str = url.match(/\?.*$/)[0];
If this url is the current one of your page, use
var str = location.search;
You can use regex
:
url.match(/\?(\w+=\w+)/)[0];
/
: Delimiter of regex
\?
: Matches ?
need to escape using \
\w+
: Matches all alphanumeric characters and _
=
: Matches =