enltr xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/terms/" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:og="http://ogp.me/ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:sioc="http://rdfs.org/sioc/ns#" xmlns:sioct="http://rdfs.org/sioc/types#" xmlns:skos="http://www.w3.org/2004/02/skos/core#" xmlns:xsd="http://www.w3.org/2001/XMLSchema#"http://www.w3.org/1999/xhtml/vocab/////////////////Get URL Query parameters using .querystring() | BitsyCodehttps://www.bitsycode.com/methods/dom/querystringGet URL Query parameters using .querystring() | BitsyCode Get URL Query parameters using .querystring() | BitsyCode html not-front not-logged-in no-sidebars page-node page-node- page-node-26 node-type-page

Get URL Query parameters using .querystring()

container

.querystring()


Description: Fetch a query string value and all parameters from URL.


Example:

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>querystring example</title>
  <script src="http://code.bitsycode.com/bitsycode-latest.min.js"></script>
</head>
<body>
 
<strong>Single Query String</strong>
<p class="querystring"></p>

<strong>All Query Strings</strong>
<p class="querystring-object"></p>

<script>
  
    //FETCH SINGLE KEY VALUE
    bitsyCode( ".querystring" ).html( bitsyCode.querystring("plugin") );
  
    //FETCH ALL KEYS AND VALUES
    var object = "";
    var result = bitsyCode.querystring({ all:true });
    
    for (var key in result) {
        object += "  "+key + " = " + result[key] + "<br />";
    }
    
    bitsyCode( ".querystring-object" ).html("{<br />" + object + "}");  
  
</script>
 
</body>
</html>

Preview:

Single Query String

BitsyCode


All Query Strings

{
plugin: BitsyCode,
version: 1.0
}

Share

Developed and built with passion and commitment.
Maintained by the bitsycode team.