Skip to content

ManZzup/jspara

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

JsPara : A JavaScript URL parser

JsPara is a simple and efficient JavaScript class for extracting GET parameters from a URL query string Support extracting parameters from both usual string and hash string ( i.e. AJAX based URL )

USAGE

  1. Initialize the JsPara object with the window URI
 jp = new JsPara(window.location);
 //ex: http://example.com/index.html?search=keyword&nothing&page=1#p=new
  1. Getting all parameters extracted
 var paras = jp.params;
 //output: search, page, p, nothing
  1. Getting value of a parameter
 var search = jp.param['search']
 //output: keyword
  1. Getting various other info about url
 var hostname = jp.hostname; // example.com
 var protocol = jp.protocol; // http
 var path = jp.path; // example.com/index.html

Some valid parameter names

test
test123
test_me
test me
test.me�
"search"
[1,"abc",'def']

& and # are not allowed [you dont say :D]

About

JsPara is a simple and efficient JavaScript class for extracting GET parameters from a URL query string

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published