Skip to content

phillipbentonkelly/JS-Get-Url-Vars

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

JS-Get-Url-Vars

Simple way to get the query params using the DOM/Window.

This extension maps URL query params to the object instance when initiated.

URL: http://pkelly/FileResource/themes/projects/hack2013/?apiKey=123MyKey&format=json&q=New%20Girl

In HTML:

<script src="getUrlVars.js"></script>

Init in a 'Script' Tag (jQuery.ready if you want, but it works without it):

<script> //GetUrlVars().isAvailable('q', 'string'); var mapUrlVars = GetUrlVars(); console.log(mapUrlVars.q); </script>

Console output: mapUrlVars = { found: true, queryParams: { format: "json", apiKey: "123MyKey", q: "New%20Girl" }, match: "New%20Girl" };

About

Simple way to get the query params using the DOM/Window

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published