- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGET_QueryString_Using_JQuery.html
More file actions
Latest commit
34 lines (33 loc) · 1.25 KB
/
Copy pathGET_QueryString_Using_JQuery.html
File metadata and controls
34 lines (33 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<!DOCTYPE html>
<htmllang="en">
<head>
<metacharset="utf-8">
<metahttp-equiv="X-UA-Compatible" content="IE=edge">
<metaname="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<metaname="description" content="Get Query String Value using JQuery">
<metaname="author" content="Dhana">
<linkrel="shortcut icon" href="./favicon.ico">
<title>Get Query String Value using JQuery</title>
</head>
<body>
<divclass="mainContainer">
<header> Query String Text:</header>
ID: <lableid="id"></lable><br/>
Name: <lableid="name"></lable>
</div>
<script>
functiongetUrlStr(){
varhashes=window.location.href.slice(window.location.href.indexOf('?')+1).split('&');
varstr=[],hash;
for(vari=0;i<hashes.length;i++){
hash=hashes[i].split('=');
str.push(hash[0]);
str[hash[0].toLowerCase()]=hash[1].toLowerCase();
}
returnstr;
}
document.getElementById("id").innerHTML=getUrlStr()["id"]==undefined ? 'No Query String for ID' : getUrlStr()["id"];
document.getElementById("name").innerHTML=getUrlStr()["name"]==undefined ? 'No Query String for Name' : getUrlStr()["name"];
</script>
</body>
</html>