Showing posts with label Javascript. Show all posts
Showing posts with label Javascript. Show all posts


What is location.search in javascript?

location is an object that provides information about current url.
"search" is a property of location object that gives query portion of the url.
For example,
if url is : http://www.sample.com?id=1&qs=5
then window.location.search will return "?id=1&qs=5".
You can apply regular expression on this result to get query string parameters in javascript/jquery in case if you don't want to go with any plugin that reads these values.