Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

urlsearchparams to object

var search = location.search.substring(1);
JSON.parse('{"' + search.replace(/&/g, '","').replace(/=/g,'":"') + '"}', function(key, value) { return key===""?value:decodeURIComponent(value) })
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #urlsearchparams #object
ADD COMMENT
Topic
Name
7+4 =