Quick Search:
 
 JavaScript: Read GET URL Variables Into An Associative Array. Jump to:  
Category: >> JavaScript >> Read GET URL Variables Into An Associative Array.  

<< lastnext >>

Snippet Name: Read GET URL Variables Into An Associative Array.

Description: This snippet read a page's GET URL variables and return them as an associative array.

Also see:
» Count the number of checked checkboxes...
» Get Relative Dates and Times
» Read GET URL Variables Into An Associa...
» Neatly trim a string to a set number o...
» Get Current Page URL
» Get Current Directory Name
» Search array elements for a substring
» Add a period at the end of a string if...
» Count capital letters in a string
» Search All Words Of A String In mySQL
» Remove Extra Spaces From A String
» Get Query String with Javascript
» Get and set radio buttons with Javascr...
» Get and set select lists with Javascri...
» Get file extension
» Get Date 30 days ago
» Create string by formatting an amount ...
» Search PL/SQL for a string/ key value
» SEQUENCE: get sequence value into vari...
» SUBST and INSTR together
» INSTR (InString)
» SUBSTR (SubString)
» Generate unique strings of random numb...
» SELECT: Get DISTINCT or UNIQUE values
» SELECT: Get UNIQUE and DISTINCT values
» TIMESTAMP: Get current timestamp
» UPDATE: Update based on a query
» String Functions: REVERSE
» String Functions: LENGTH
» String Functions: INSTR

Comment: (none)

Language: JAVASCRIPT
Highlight Mode: HTML4STRICT
Last Modified: May 28th, 2010

// Read a page's GET URL variables and 
// return them as an associative array.
 
function getUrlVars(){
    var vars = [], hash;
    var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
 
    for(var i = 0; i < hashes.length; i++)
    {
        hash = hashes[i].split('=');
        vars.push(hash[0]);
        vars[hash[0]] = hash[1];
    }
 
    return vars;
}


 
   Home |    Search |    Code Library |    Sponsors |    Privacy |    Terms of Use |    Contact Us © 2003 - 2024 psoug.org