var url = window.location.href;
result:
https://test.com/index.html?Event=90000002
how do I use Javascript to get 90000002
and put it in a variable?
var url = window.location.href;
result:
https://test.com/index.html?Event=90000002
how do I use Javascript to get 90000002
and put it in a variable?
You can use the .split() method
var data=url.split("=")[1]
Should return what you got after '='
Though this is not optimized way but you can still do like this
Use location
object and it's search property.
location.search will return ?Event=90000002
. Then use substring
to get the value
var a = location.search;
console.log(a.substring(7,a.length))