Created
January 25, 2017 15:20
-
-
Save kparms/054291450962c7071c6d12171d913867 to your computer and use it in GitHub Desktop.
Get Querystring values from URL using Javascript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* KP: Read in querystring values and perform filtering */ | |
var path = window.location.href; | |
$scope.searchTerms = path.indexOf('?') > 0 ? path.split('?')[1].split('&') : []; | |
if ($scope.searchTerms.length > 0) { | |
for (i = 0; i < $scope.searchTerms.length; i++) { | |
var searchTerm = $scope.searchTerms[i].split('='); | |
var name = searchTerm[0]; | |
var value = searchTerm[1]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment