{"id":697,"date":"2010-11-20T14:17:19","date_gmt":"2010-11-20T12:17:19","guid":{"rendered":"http:\/\/patchlog.com\/?p=697"},"modified":"2010-11-20T14:17:19","modified_gmt":"2010-11-20T12:17:19","slug":"url-parameters-in-javascript","status":"publish","type":"post","link":"https:\/\/patchlog.com\/web\/url-parameters-in-javascript\/","title":{"rendered":"URL parameters in Javascript"},"content":{"rendered":"<p>I wanted a piece of code in pure javascript ( no framework required ) that could extract the parameters in the query string part of an URL.<\/p>\n<p>I wanted it to be able to extract the parameters in this format name[key]=value\u00c2\u00a0 like they are used in php applications.<\/p>\n<p>I found a piece of code on some other blogs or forum posts but it didn't work as I expected so here is my take on this.<\/p>\n<pre><ol><li style=\"font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;\"><div style=\"font-family: 'Courier New', Courier, monospace; font-weight: normal;\">&nbsp;<\/div><\/li><\/ol><\/pre>\n<p>This function one limitation: It doesn't work with multidimensional arrays. It's probably not hard to modify it to work like that but I only needed it to work with single dimension arrays. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>I wanted a piece of code in pure javascript ( no framework required ) that could extract the parameters in the query string part of an URL. I wanted it to be able to extract the parameters in this format name[key]=value\u00c2\u00a0 like they are used in php applications. I found a piece of code on &hellip; <a href=\"https:\/\/patchlog.com\/web\/url-parameters-in-javascript\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">URL parameters in Javascript<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[16],"tags":[313,201,312,178],"class_list":["post-697","post","type-post","status-publish","format-standard","hentry","category-web","tag-function","tag-javascript","tag-params","tag-url"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pofPh-bf","jetpack_sharing_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/patchlog.com\/wp-json\/wp\/v2\/posts\/697","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/patchlog.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/patchlog.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/patchlog.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/patchlog.com\/wp-json\/wp\/v2\/comments?post=697"}],"version-history":[{"count":9,"href":"https:\/\/patchlog.com\/wp-json\/wp\/v2\/posts\/697\/revisions"}],"predecessor-version":[{"id":706,"href":"https:\/\/patchlog.com\/wp-json\/wp\/v2\/posts\/697\/revisions\/706"}],"wp:attachment":[{"href":"https:\/\/patchlog.com\/wp-json\/wp\/v2\/media?parent=697"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/patchlog.com\/wp-json\/wp\/v2\/categories?post=697"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/patchlog.com\/wp-json\/wp\/v2\/tags?post=697"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}